File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5454 run : |
5555 echo "Cancelling runs for PR #$PR_NUMBER..."
5656
57- # Get all runs for the PR that are NOT completed, excluding this current run
58- RUN_IDS=$(gh run list --pr "$PR_NUMBER" --limit 200 --json databaseId,status --jq '.[] | select(.status != "completed" and .databaseId != (env.CURRENT_RUN_ID | tonumber)) | .databaseId')
57+ # gh run list doesn't have a --pr flag, so we get the branch name first
58+ PR_BRANCH=$(gh pr view "$PR_NUMBER" --json headRefName -q .headRefName)
59+
60+ # Get all runs for the PR branch that are NOT completed, excluding this current run
61+ RUN_IDS=$(gh run list --branch "$PR_BRANCH" --limit 200 --json databaseId,status --jq '.[] | select(.status != "completed" and .databaseId != (env.CURRENT_RUN_ID | tonumber)) | .databaseId')
5962
6063 if [ -z "$RUN_IDS" ]; then
6164 echo "No active runs found to cancel."
You can’t perform that action at this time.
0 commit comments