Skip to content

Commit b9042fd

Browse files
committed
ci: robustly extract PR numbers in emoji merge delegate workflow (#36732)
The previous `awk -F# '{ gsub(/)$/, ""); print $NF}'` pipeline was fragile: for commits without a `(#PR)` suffix it passed the entire commit line (hash + message) to the Python script, which crashed when treating that string as a regex pattern. There should rarely be a commit without a `(#PR)` suffix, as usually commits come via bors, but there's no point leaving this loaded gun lying around. Replace with `grep -oP '(?<=\(#)\d+(?=\))'` which only emits the digit string from commits that contain the exact `(#NUMBER)` pattern, and silently skips any commit without a PR number. 🤖 Prepared with Claude Code
1 parent 7d9358e commit b9042fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.github/workflows/zulip_emoji_merge_delegate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ jobs:
5454
while read -r pr_number; do
5555
printf $'Running the python script with pr "%s"\n' "${pr_number}"
5656
python "${CI_SCRIPTS_DIR}/zulip/zulip_emoji_reactions.py" "$ZULIP_API_KEY" "$ZULIP_EMAIL" "$ZULIP_SITE" "[Merged by Bors]" "none" "${pr_number}"
57-
done < <(git log --oneline -n 10 | awk -F# '{ gsub(/)$/, ""); print $NF}')
57+
done < <(git log --oneline -n 10 | grep -oP '(?<=\(#)\d+(?=\))')

0 commit comments

Comments
 (0)