From bbcf640423281401ac39b1c4fe691cfb341f00e1 Mon Sep 17 00:00:00 2001 From: Daniel Pawlik Date: Wed, 12 Nov 2025 18:36:52 +0100 Subject: [PATCH 1/2] Take commit msg from SHA-1 to verify pr prefix; don't count Signed-Off-By Commit fixes issues: - git body count characters "fits" for requirements when "Signed-Off-By" was set - take commit message from commit SHA-1 instead of compute it in the script in Github workflows Signed-off-by: Daniel Pawlik --- .github/workflows/verify-pr-prefix.yml | 7 ++++++- scripts/check-role-prefix.sh | 8 ++++++-- scripts/git-check-commit-body-length.sh | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/verify-pr-prefix.yml b/.github/workflows/verify-pr-prefix.yml index d446b1ddb..fc47fd237 100644 --- a/.github/workflows/verify-pr-prefix.yml +++ b/.github/workflows/verify-pr-prefix.yml @@ -20,7 +20,12 @@ jobs: with: fetch-depth: 0 + - name: Dump commit message to file + run: | + git fetch origin ${{ github.event.pull_request.head.sha }} + git log -1 --pretty=format:"%B" ${{ github.event.pull_request.head.sha }} | head -n1 > commit-message-file + - name: Run commit message check id: prefixcheck run: | - ./scripts/check-role-prefix.sh + ./scripts/check-role-prefix.sh commit-message-file diff --git a/scripts/check-role-prefix.sh b/scripts/check-role-prefix.sh index 73e5a8dea..6ee3ba722 100755 --- a/scripts/check-role-prefix.sh +++ b/scripts/check-role-prefix.sh @@ -1,8 +1,12 @@ #!/bin/bash # Get the latest commit message file -TMP_MSG_FILE=$(mktemp) -git log -1 --pretty=format:"%s%n%n%b" >"$TMP_MSG_FILE" +TMP_MSG_FILE="$1" + +if [ -z "$TMP_MSG_FILE" ]; then + TMP_MSG_FILE=$(mktemp) + git log -1 --pretty=format:"%B" | head -n1 +fi echo "Checking latest commit message:" cat "$TMP_MSG_FILE" diff --git a/scripts/git-check-commit-body-length.sh b/scripts/git-check-commit-body-length.sh index 2ce9e64ea..656806a9a 100755 --- a/scripts/git-check-commit-body-length.sh +++ b/scripts/git-check-commit-body-length.sh @@ -20,7 +20,7 @@ FAIL_LENGTH=0 FAIL_SIGNED_OFF_BY=0 BODY=$(tail -n +3 "$MSG_FILE" | sed '/^\s*#/d' | sed '/^\s*$/d') -BODY_LEN=$(echo -n "$BODY" | wc -m) +BODY_LEN=$(echo -n "$BODY" | sed '/Signed-off-by:/d' | wc -m) if [ "$BODY_LEN" -lt "$MIN_BODY_LEN" ]; then echo -e "\n\n**WARNING: Commit message body is too short (has $BODY_LEN chars, minimum $MIN_BODY_LEN required).**\n" >&2 From 4f448a0eef1cdd6455720885fa8da20bc7f07d86 Mon Sep 17 00:00:00 2001 From: Michael Burke Date: Wed, 12 Nov 2025 13:07:03 -0500 Subject: [PATCH 2/2] [reproducer] testing fix Signed-off-by: Michael Burke --- roles/reproducer/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/reproducer/defaults/main.yml b/roles/reproducer/defaults/main.yml index ca312765d..da2ed7edd 100644 --- a/roles/reproducer/defaults/main.yml +++ b/roles/reproducer/defaults/main.yml @@ -16,7 +16,7 @@ # All variables intended for modification should be placed in this file. -# All variables within this role should have a prefix of "cifmw_reproducer" +# All variables within this role should have a prefix of "cifmw_reproducer". cifmw_reproducer_controller_user: "{{ hostvars['controller-0']['ansible_ssh_user'] | default('zuul') }}" cifmw_reproducer_controller_user_dir: "/home/{{ cifmw_reproducer_controller_user }}" cifmw_reproducer_controller_basedir: "{{ cifmw_reproducer_controller_user_dir }}/ci-framework-data"