Skip to content

Commit 1a9f647

Browse files
committed
ci: handle empty commit list
And add more log output to help with possible after the fact debugging...
1 parent aa642e7 commit 1a9f647

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/send-emails.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ jobs:
7878
run: |
7979
# Skip if PR has label "no-ml"
8080
if echo "$PR_LABELS" | grep -qiE "(^|,)no-ml(,|$)"; then
81-
echo "Opt-out label present: skipping mailing list."
82-
echo "Opt-out label present: skipping mailing list." > $GITHUB_STEP_SUMMARY
81+
echo "Opt-out label present: skipping mailing list." | tee $GITHUB_STEP_SUMMARY
8382
exit 0
8483
fi
8584
@@ -104,21 +103,27 @@ jobs:
104103
git fetch origin "pull/$PR_NUMBER/head"
105104
106105
gh api repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/commits --jq '.[].sha' | while read SHA1; do
106+
echo "Looking at $SHA1"
107107
if grep -q -E "$regex" <(git diff-tree --no-commit-id --name-only -r "$SHA1"); then
108108
echo "Touching something not to be upstreamed, skipping commit $SHA1"
109109
else
110110
echo "$SHA1" >> /tmp/commits.txt
111111
fi
112112
done
113113
114+
if [ ! -f /tmp/commits.txt ]; then
115+
echo "No commits to send email for" | tee $GITHUB_STEP_SUMMARY
116+
exit 0
117+
fi
118+
114119
COUNT=$(wc -l < /tmp/commits.txt)
115120
echo "COUNT=$COUNT" >> $GITHUB_ENV
116121
117122
- name: Check what to do based on series' size
118123
run: |
119124
MAX=150
120125
if [ "${COUNT}" -gt "$MAX" ]; then
121-
echo "Series has $COUNT commits (> $MAX). Not doing anything" >> $GITHUB_STEP_SUMMARY
126+
echo "Series has $COUNT commits (> $MAX). Not doing anything" | tee $GITHUB_STEP_SUMMARY
122127
exit 0
123128
fi
124129

0 commit comments

Comments
 (0)