Skip to content

Commit 31c1bcb

Browse files
committed
tools: delay removal of commit-queue label
The removes the possiblity for a PR to drop from the queue if the CQ job is cancelled (or times out) in the middle of handling a PR. This increases the window for two concurrent CQ jobs to pick up the same PR, but that's an unlikely scenario. Signed-off-by: Antoine du Hamel <[email protected]> PR-URL: #65101 Refs: #64972 Reviewed-By: René <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Aviv Keller <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
1 parent 5b64b37 commit 31c1bcb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tools/actions/commit-queue.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ COMMIT_QUEUE_FAILED_LABEL="commit-queue-failed"
1515
commit_queue_failed() {
1616
pr=$1
1717

18-
gh pr edit "$pr" --add-label "${COMMIT_QUEUE_FAILED_LABEL}"
18+
gh pr edit "$pr" --add-label "${COMMIT_QUEUE_FAILED_LABEL}" --remove-label "${COMMIT_QUEUE_LABEL}"
1919

2020
# shellcheck disable=SC2154
2121
cqurl="${GITHUB_SERVER_URL}/${OWNER}/${REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
@@ -47,9 +47,6 @@ for pr in "$@"; do
4747
continue
4848
fi
4949

50-
# Delete the commit queue label
51-
gh pr edit "$pr" --remove-label "$COMMIT_QUEUE_LABEL"
52-
5350
if jq -e 'map(.name) | index("commit-queue-squash")' < labels.json; then
5451
MULTIPLE_COMMIT_POLICY="--fixupAll"
5552
elif jq -e 'map(.name) | index("commit-queue-rebase")' < labels.json; then
@@ -114,6 +111,9 @@ for pr in "$@"; do
114111
gh pr comment "$pr" --body "Landed in $commits"
115112

116113
[ -z "$MULTIPLE_COMMIT_POLICY" ] && gh pr close "$pr"
114+
115+
# Delete the commit queue label (but ignore errors, it's no big deal if a closed PR still has the label)
116+
gh pr edit "$pr" --remove-label "$COMMIT_QUEUE_LABEL" || true
117117
done
118118

119119
rm -f labels.json

0 commit comments

Comments
 (0)