Skip to content

Commit 11da56b

Browse files
committed
ci: fix early exit
exit 0 does not work
1 parent 1a9f647 commit 11da56b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/send-emails.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,19 @@ jobs:
7575
echo "SERIES_DIR=/tmp/series" >> $GITHUB_ENV
7676
7777
- name: Check for label 'no-ml' to skip sending emails
78+
id: checklabel
7879
run: |
7980
# Skip if PR has label "no-ml"
8081
if echo "$PR_LABELS" | grep -qiE "(^|,)no-ml(,|$)"; then
8182
echo "Opt-out label present: skipping mailing list." | tee $GITHUB_STEP_SUMMARY
82-
exit 0
83+
echo "skip_sending=1" >> $GITHUB_OUTPUT
84+
else
85+
echo "skip_sending=0" >> $GITHUB_OUTPUT
8386
fi
8487
8588
- name: Get commit list from PR and skip the internal ones
8689
id: commits
90+
if: ${{ steps.checklabel.outputs.skip_sending != '1' }}
8791
run: |
8892
# Skip commits that touches any of these
8993
patterns=(".github/"
@@ -113,21 +117,27 @@ jobs:
113117
114118
if [ ! -f /tmp/commits.txt ]; then
115119
echo "No commits to send email for" | tee $GITHUB_STEP_SUMMARY
120+
echo "skip_sending=1" >> $GITHUB_OUTPUT
116121
exit 0
117122
fi
118123
124+
echo "skip_sending=0" >> $GITHUB_OUTPUT
119125
COUNT=$(wc -l < /tmp/commits.txt)
120126
echo "COUNT=$COUNT" >> $GITHUB_ENV
121127
122128
- name: Check what to do based on series' size
129+
if: ${{ steps.commits.outputs.skip_sending != '1' }}
130+
id: checksize
123131
run: |
124132
MAX=150
125133
if [ "${COUNT}" -gt "$MAX" ]; then
126134
echo "Series has $COUNT commits (> $MAX). Not doing anything" | tee $GITHUB_STEP_SUMMARY
127-
exit 0
135+
echo "skip_sending=1" >> $GITHUB_OUTPUT
128136
fi
137+
echo "skip_sending=0" >> $GITHUB_OUTPUT
129138
130139
- name: Prepare patch series
140+
if: ${{ steps.checksize.outputs.skip_sending != '1' }}
131141
run: |
132142
set -euo pipefail
133143
@@ -184,6 +194,7 @@ jobs:
184194
done < <(find /tmp/series/ -maxdepth 1 -type f -print0|sort -z -n)
185195
186196
- name: Send series via git send-email
197+
if: ${{ steps.checksize.outputs.skip_sending != '1' }}
187198
env:
188199
GIT_SMTP_SERVER: ${{ secrets.SMTP_SERVER }}
189200
GIT_SMTP_ENCRYPTION: tls

0 commit comments

Comments
 (0)