Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/commit-queue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,23 @@ jobs:
run: ./tools/actions/commit-queue.sh "${GITHUB_REPOSITORY_OWNER}" "${REPOSITORY}" ${{ needs.get_mergeable_prs.outputs.numbers }}
env:
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
cleanup:
needs: [get_mergeable_prs, commitQueue]
if: cancelled() && needs.get_mergeable_prs.outputs.numbers != ''
runs-on: ubuntu-slim
permissions:
pull-requests: write
steps:
- name: Re-add labels if needed
# If a PR was in the queue, is still open and has neither `commit-queue`
# nor `commit-queue-failed`, we assume it needs to get back into the queue.
run: |
for pr in $PRs; do
gh pr view --repo "$GITHUB_REPOSITORY" "$pr" \
--json state,labels \
--jq 'if .state == "OPEN" and all(.labels[]; .name != "commit-queue" and .name != "commit-queue-failed") then halt_error end' \
|| gh pr edit --repo "$GITHUB_REPOSITORY" "$pr" --add-label commit-queue
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRs: ${{ needs.get_mergeable_prs.outputs.numbers }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than re-adding the label, why don't we change the CQ to not remove it until it either completes or fails (reducing our calls to the GitHub API)

concurrency: ${{ github.workflow }}

This line would prevent a PR from being picked up twice, so I see no harm in waiting to remove the label

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The consequence would be there would be merged PRs with the label, but yeah I'm not sure if that's actually an issue. Feel free to push to this branch or open an alternative PR

Loading