Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/verify-pr-prefix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion roles/reproducer/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 6 additions & 2 deletions scripts/check-role-prefix.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion scripts/git-check-commit-body-length.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading