CI: Fix cancellation workflow API flags, permissions, and filters#7228
Open
arpittkhandelwal wants to merge 1 commit intoTheHPXProject:masterfrom
Open
CI: Fix cancellation workflow API flags, permissions, and filters#7228arpittkhandelwal wants to merge 1 commit intoTheHPXProject:masterfrom
arpittkhandelwal wants to merge 1 commit intoTheHPXProject:masterfrom
Conversation
Up to standards ✅🟢 Issues
|
Contributor
There was a problem hiding this comment.
Pull request overview
Follow-up fixes to the manual CI workflow cancellation automation (introduced in #7205) to address GitHub CLI/API limitations encountered in production and make the cancellation tool reliably operational.
Changes:
- Replace unsupported
gh run list --prusage by first resolving the PR head branch and filtering runs via--branch. - Expand workflow permissions to allow label removal (
issues: write) and fix self-exclusion injqby castingCURRENT_RUN_IDto a number. - Increase
gh run listpagination limit to capture more active runs (--limit 200).
ab68807 to
7dcdc8f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
This PR contains follow-up fixes for the manual workflow cancellation tool introduced in #7205. While the
cancel-cilabel and/cancel-cicomment triggers are in place, the script encountered a few GitHub CLI and API limitations in production that caused it to fail.Errors Fixed
This PR addresses the following issues to make the script fully operational and robust:
gh api). This ensures that only runs specifically tied to the PR number are cancelled, avoiding any issues with common branch names (e.g.,patch-1) or forks.issues: writepermissions so thatgh pr editcan successfully remove thecancel-cilabel.set -euo pipefailfor strict shell execution and usedtonumberin thejqfilter to reliably exclude the current run from being cancelled.--per_page=100to the API call to ensure all active runs are captured on busy PRs.Key Code Updates
The core logic now uses the GitHub API for precise targeting: