Skip to content

Commit 8c9fcb9

Browse files
committed
ci: fix reference check
ChangeLog: * .github/workflows/commit-format.yml: adjust grep. Signed-off-by: Marc Poulhiès <[email protected]>
1 parent 9a4acf1 commit 8c9fcb9

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

.github/workflows/commit-format.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,23 @@ jobs:
125125
retval=0;
126126
rev_list="origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}"
127127
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"
128+
129+
git log --format=%B -n 1 "$commit" > /tmp/commit_log
130+
131+
if grep -P '(^|[^\w]+)#[0-9]+' /tmp/commit_log > /tmp/found ; then
132+
echo "$commit: KO because it has one or more bad references" | tee -a $GITHUB_STEP_SUMMARY
133+
cat /tmp/found | tee -a $GITHUB_STEP_SUMMARY
130134
retval=1
131135
else
132136
echo "$commit: OK"
133137
fi
134138
done;
139+
135140
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."
141+
echo "Some raw issue references were found (eg. #4242)." | tee -a $GITHUB_STEP_SUMMARY
142+
echo "You shall rewrite the faulty commit message with this format: Rust-GCC/gccrs#4242" | tee -a $GITHUB_STEP_SUMMARY
143+
echo "You may ignore this CI step if it represents a valid GCC bugzilla or external repository reference instead." | tee -a $GITHUB_STEP_SUMMARY
144+
else
145+
echo "No unadorned references found" | tee $GITHUB_STEP_SUMMARY
139146
fi
140147
exit $retval;

0 commit comments

Comments
 (0)