Skip to content

Commit 5090576

Browse files
P-E-Pdkm
authored andcommitted
Add a new CI step to detect raw issue references
Issue references shall now be used with the Rust GCC prefix in order to avoid mixing gccrs issues and GCC bugzilla PRs. ChangeLog: * .github/workflows/commit-format.yml: Add a new step to detect issue references in commit messages. Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
1 parent 6ebcebf commit 5090576

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/commit-format.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,33 @@ jobs:
108108
done < <(git rev-list --reverse "$rev_list" )
109109
110110
exit $retval;
111+
112+
check-issue-reference:
113+
runs-on: ubuntu-latest
114+
continue-on-error: true # We do not want to block merge if it is a legitimate GCC bugzilla reference.
115+
name: check-issue-reference
116+
117+
steps:
118+
- uses: actions/checkout@v3
119+
with:
120+
ref: ${{ github.event.pull_request.head.sha }}
121+
fetch-depth: 0
122+
123+
- name: Check for issue number reference in commit messages
124+
run: |
125+
retval=0;
126+
rev_list="origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}"
127+
for commit in $(git rev-list --reverse "$rev_list"); do
128+
if [ "$(git log --format=%B -n 1 \"$commit\" | grep '#[0-9]*' | grep -v -i 'Rust-GCC/gccrs#[0-9]*' | wc -l)" -ne 0 ]; then
129+
echo "$commit: KO"
130+
retval=1
131+
else
132+
echo "$commit: OK"
133+
fi
134+
done;
135+
if [ "$retval" -ne 0 ]; then
136+
echo "Some raw issue references were found (eg. #4242)."
137+
echo "You shall rewrite the faulty commit message with this format: Rust-GCC/gccrs#4242"
138+
echo "You may ignore this CI step if it represents a valid GCC bugzilla or external repository reference instead."
139+
fi
140+
exit $retval;

0 commit comments

Comments
 (0)