Skip to content

Commit c541030

Browse files
committed
Improve bot and web-flow commit handling in compliance workflow
- Refactored `CheckSignedOffCommit` condition to simplify bot detection logic. - Added logic to skip bot and web-flow commits when verifying signed-off messages in workflows. - Enhanced logging for skipped commits with clearer messages. Signed-off-by: Alexander Adam <alphaone23@gmail.com>
1 parent c5e4988 commit c541030

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

.github/workflows/compliance.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ jobs:
3838
CheckSignedOffCommit:
3939
if: >
4040
github.event_name == 'push' &&
41-
!startsWith(github.actor, 'dependabot') &&
42-
github.event.pusher.name != 'web-flow' &&
43-
github.event.pusher.name != 'github-actions[bot]' &&
44-
github.event.pusher.name != 'github-merge-queue[bot]'
41+
!contains(github.actor, '[bot]') &&
42+
!contains(github.event.pusher.name, '[bot]') &&
43+
github.event.pusher.name != 'web-flow'
4544
runs-on: ubuntu-latest
4645
permissions:
4746
contents: read
@@ -81,6 +80,15 @@ jobs:
8180
while read -r sha
8281
do
8382
[ -n "$sha" ] || continue
83+
84+
# Skip commits from bots
85+
committer_name=`git log --format=%cn -n 1 "$sha"`
86+
if echo "$committer_name" | grep -Fq '[bot]' || [ "$committer_name" = "web-flow" ]
87+
then
88+
echo "Skipping bot/web-flow commit $sha from $committer_name"
89+
continue
90+
fi
91+
8492
msg=`git log --format=%B -n 1 "$sha"`
8593
8694
if ! printf '%s' "$msg" | grep -Eqi '^[[:space:]]*Signed[- ]off[- ]by:'
@@ -136,6 +144,15 @@ jobs:
136144
while read -r sha
137145
do
138146
[ -n "$sha" ] || continue
147+
148+
# Skip commits from bots
149+
committer_name=`git log --format=%cn -n 1 "$sha"`
150+
if echo "$committer_name" | grep -Fq '[bot]' || [ "$committer_name" = "web-flow" ]
151+
then
152+
echo "Skipping bot/web-flow commit $sha from $committer_name"
153+
continue
154+
fi
155+
139156
msg=`git log --format=%B -n 1 "$sha"`
140157
141158
if ! printf '%s' "$msg" | grep -Eqi '^[[:space:]]*Signed[- ]off[- ]by:'

0 commit comments

Comments
 (0)