Skip to content

Commit 5b5945a

Browse files
committed
ci: yet another fix for the conditionnal steps
hashFiles() only works with files in $GITHUB_WORKSPACE, not /tmp. Probably cleaner to use the "outputs" machinery anyway. Signed-off-by: Marc Poulhiès <[email protected]>
1 parent 0a8139f commit 5b5945a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

.github/workflows/send-emails.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,23 +117,23 @@ jobs:
117117
118118
if [ ! -f /tmp/commits.txt ]; then
119119
echo "No commits to send email for" | tee $GITHUB_STEP_SUMMARY
120-
exit 0
120+
echo "has_commits=false" >> $GITHUB_OUTPUT
121+
else
122+
COUNT=$(wc -l < /tmp/commits.txt)
123+
echo "COUNT=$COUNT" >> $GITHUB_ENV
124+
echo "has_commits=true" >> $GITHUB_OUTPUT
121125
fi
122126
123-
COUNT=$(wc -l < /tmp/commits.txt)
124-
echo "COUNT=$COUNT" >> $GITHUB_ENV
125-
126127
- name: Check what to do based on series' size
127-
if: ${{ hashFiles('/tmp/commits.txt') != '' }}
128-
id: checksize
128+
if: steps.commits.outputs.has_commits == 'true'
129129
run: |
130130
MAX=150
131131
if [ "${COUNT}" -gt "$MAX" ]; then
132132
echo "Series has $COUNT commits (> $MAX). Not doing anything" | tee $GITHUB_STEP_SUMMARY
133133
fi
134134
135135
- name: Prepare patch series
136-
if: ${{ hashFiles('/tmp/commits.txt') != '' }}
136+
if: steps.commits.outputs.has_commits == 'true'
137137
run: |
138138
set -euo pipefail
139139
@@ -190,7 +190,7 @@ jobs:
190190
done < <(find /tmp/series/ -maxdepth 1 -type f -print0|sort -z -n)
191191
192192
- name: Send series via git send-email
193-
if: ${{ hashFiles('/tmp/commits.txt') != '' }}
193+
if: steps.commits.outputs.has_commits == 'true'
194194
env:
195195
GIT_SMTP_SERVER: ${{ secrets.SMTP_SERVER }}
196196
GIT_SMTP_ENCRYPTION: tls

0 commit comments

Comments
 (0)