Skip to content

Commit 957d8ce

Browse files
committed
Improve compliance workflow to handle bot and web-flow pushes gracefully.
Signed-off-by: Alexander Adam <alphaone23@gmail.com>
1 parent 09533c8 commit 957d8ce

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

.github/workflows/compliance.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,25 @@ jobs:
3838

3939
- name: Determine pushed commits
4040
if: >
41-
github.event_name == 'push' &&
42-
!contains(github.actor, '[bot]') &&
43-
!contains(github.event.pusher.name, '[bot]') &&
44-
github.event.pusher.name != 'web-flow'
41+
github.event_name == 'push'
4542
env:
4643
# Use GitHub-provided SHAs to build the range for this push
4744
BEFORE: ${{ github.event.before }}
4845
AFTER: ${{ github.sha }}
46+
GH_ACTOR: ${{ github.actor }}
47+
GH_PUSHER: ${{ github.event.pusher.name }}
4948
run: |
5049
set -euo pipefail
5150
51+
# Bot / web-flow pushes: create empty file so later steps succeed
52+
if echo "$GH_ACTOR" | grep -Fq '[bot]' \
53+
|| echo "$GH_PUSHER" | grep -Fq '[bot]' \
54+
|| [ "$GH_PUSHER" = "web-flow" ]
55+
then
56+
touch shas.txt
57+
exit 0
58+
fi
59+
5260
if [ "$BEFORE" = "0000000000000000000000000000000000000000" ]
5361
then
5462
# New branch or force push without previous SHA
@@ -72,7 +80,7 @@ jobs:
7280
- name: Check for Signed-off-by
7381
env:
7482
GH_ACTOR: ${{ github.actor }}
75-
GH_NAME: ${{ github.event.name == 'push' && github.event.pusher.name
83+
GH_NAME: ${{ github.event_name == 'push' && github.event.pusher.name
7684
|| github.event.pull_request.user.login }}
7785
GH_NAME_SOURCE: ${{ github.event_name == 'push' && 'github.event.pusher.name'
7886
|| 'github.event.pull_request.user.login' }}

0 commit comments

Comments
 (0)