diff --git a/tools/actions/commit-queue.sh b/tools/actions/commit-queue.sh index aa63a442377a..b6e62139d626 100755 --- a/tools/actions/commit-queue.sh +++ b/tools/actions/commit-queue.sh @@ -15,7 +15,7 @@ COMMIT_QUEUE_FAILED_LABEL="commit-queue-failed" commit_queue_failed() { pr=$1 - gh pr edit "$pr" --add-label "${COMMIT_QUEUE_FAILED_LABEL}" + gh pr edit "$pr" --add-label "${COMMIT_QUEUE_FAILED_LABEL}" --remove-label "${COMMIT_QUEUE_LABEL}" # shellcheck disable=SC2154 cqurl="${GITHUB_SERVER_URL}/${OWNER}/${REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" @@ -47,9 +47,6 @@ for pr in "$@"; do continue fi - # Delete the commit queue label - gh pr edit "$pr" --remove-label "$COMMIT_QUEUE_LABEL" - if jq -e 'map(.name) | index("commit-queue-squash")' < labels.json; then MULTIPLE_COMMIT_POLICY="--fixupAll" elif jq -e 'map(.name) | index("commit-queue-rebase")' < labels.json; then @@ -114,6 +111,9 @@ for pr in "$@"; do gh pr comment "$pr" --body "Landed in $commits" [ -z "$MULTIPLE_COMMIT_POLICY" ] && gh pr close "$pr" + + # Delete the commit queue label (but ignore errors, it's no big deal if a closed PR still has the label) + gh pr edit "$pr" --remove-label "$COMMIT_QUEUE_LABEL" || true done rm -f labels.json