Skip to content

Commit 5c63b4c

Browse files
committed
ci: fix the issue reference scrapper when there's no ref
grep returned an error when there was no reference, causing the workflow to stop. ChangeLog: .github/workflows/send-emails.yml: fix issue ref scrapping. Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
1 parent 98d729a commit 5c63b4c

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

.github/workflows/send-emails.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -228,21 +228,23 @@ jobs:
228228
229229
## find issue(s) referenced in commit message
230230
gccrs_ref_regex='Rust-GCC/gccrs#[0-9]+'
231-
git show -s --format=%B "$SHA1" | \
232-
grep -Eo "$gccrs_ref_regex" | \
233-
sort -u > "$LINKED_ISSUES_LIST_FILE"
234-
235-
echo "Issues list: >>>"
236-
cat "$LINKED_ISSUES_LIST_FILE"
237-
echo "<<<"
238-
echo
239-
240-
if [ -s "$LINKED_ISSUES_LIST_FILE" ]; then
241-
echo -e "\nThe commit has been mentioned in the following issue(s):" >> /tmp/tmp_descr.txt
242-
while read -r i; do
243-
ISSUE_NUM=${i##*#} # 1234
244-
echo " - $i: https://github.com/Rust-GCC/gccrs/issues/${ISSUE_NUM}" >> /tmp/tmp_descr.txt
245-
done < "$LINKED_ISSUES_LIST_FILE"
231+
if git show -s --format=%B "$SHA1" | \
232+
grep -Eo "$gccrs_ref_regex" | \
233+
sort -u > "$LINKED_ISSUES_LIST_FILE";
234+
then
235+
236+
echo "Issues list: >>>"
237+
cat "$LINKED_ISSUES_LIST_FILE"
238+
echo "<<<"
239+
echo
240+
241+
echo -e "\nThe commit has been mentioned in the following issue(s):" >> /tmp/tmp_descr.txt
242+
while read -r i; do
243+
ISSUE_NUM=${i##*#} # 1234
244+
echo " - $i: https://github.com/Rust-GCC/gccrs/issues/${ISSUE_NUM}" >> /tmp/tmp_descr.txt
245+
done < "$LINKED_ISSUES_LIST_FILE"
246+
else
247+
echo -e "\nThe commit has NOT been mentioned in any issue." | tee -a "$GITHUB_STEP_SUMMARY" /tmp/tmp_descr.txt
246248
fi
247249
248250
## find corresponding pull-request(s)

0 commit comments

Comments
 (0)