Skip to content

CI: Fix cancellation workflow API flags, permissions, and filters#7228

Open
arpittkhandelwal wants to merge 1 commit into
TheHPXProject:masterfrom
arpittkhandelwal:ci/cancel-workflow-fixes
Open

CI: Fix cancellation workflow API flags, permissions, and filters#7228
arpittkhandelwal wants to merge 1 commit into
TheHPXProject:masterfrom
arpittkhandelwal:ci/cancel-workflow-fixes

Conversation

@arpittkhandelwal
Copy link
Copy Markdown
Contributor

@arpittkhandelwal arpittkhandelwal commented Apr 27, 2026

Background

This PR contains follow-up fixes for the manual workflow cancellation tool introduced in #7205. While the cancel-ci label and /cancel-ci comment 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:

  1. Precise PR Filtering: Switched from branch-based filtering to a direct GitHub API query (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.
  2. "Resource not accessible" Error: Added issues: write permissions so that gh pr edit can successfully remove the cancel-ci label.
  3. Safety & Self-Cancellation: Added set -euo pipefail for strict shell execution and used tonumber in the jq filter to reliably exclude the current run from being cancelled.
  4. Pagination Limit: Added --per_page=100 to 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:

# Fetch recent runs and filter by the specific PR number
RUN_IDS=$(gh api "/repos/${{ github.repository }}/actions/runs?per_page=100" \
  --jq ".workflow_runs[] | select(.status != \"completed\" and .id != (env.CURRENT_RUN_ID | tonumber) and any(.pull_requests[]; .number == ($PR_NUMBER | tonumber))) | .id")

Copilot AI review requested due to automatic review settings April 27, 2026 17:58
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 27, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 --pr usage 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 in jq by casting CURRENT_RUN_ID to a number.
  • Increase gh run list pagination limit to capture more active runs (--limit 200).

Comment thread .github/workflows/cancel-workflows.yml Outdated
Comment thread .github/workflows/cancel-workflows.yml Outdated
@hkaiser
Copy link
Copy Markdown
Contributor

hkaiser commented May 19, 2026

@arpittkhandelwal Could you please rebase this onto master? That should resolve most of the CI errors.

@arpittkhandelwal arpittkhandelwal force-pushed the ci/cancel-workflow-fixes branch from 7dcdc8f to 338c0f8 Compare May 19, 2026 16:28
Copilot AI review requested due to automatic review settings May 19, 2026 16:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/cancel-workflows.yml Outdated
Comment thread .github/workflows/cancel-workflows.yml
Signed-off-by: arpittkhandelwal <arpitkhandelwal810@gmail.com>
@arpittkhandelwal arpittkhandelwal force-pushed the ci/cancel-workflow-fixes branch from 338c0f8 to b99a60d Compare May 19, 2026 16:32
@StellarBot
Copy link
Copy Markdown
Collaborator

Performance test report

HPX Performance

Comparison

BENCHMARKFORK_JOIN_EXECUTORPARALLEL_EXECUTORSCHEDULER_EXECUTOR
For Each(=)(=)(=)

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T14:08:29+00:002026-05-19T16:32:11+00:00
HPX Commit0eeca86283e4a5
Envfile
Datetime2026-03-09T09:15:24.034803-05:002026-05-19T21:04:02.405537-05:00
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Clusternamerostamrostam

Comparison

BENCHMARKNO-EXECUTOR
Future Overhead - Create Thread Hierarchical - Latch++

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T14:08:29+00:002026-05-19T16:32:11+00:00
HPX Commit0eeca86283e4a5
Envfile
Datetime2026-03-09T09:17:15.638328-05:002026-05-19T21:06:07.153669-05:00
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Clusternamerostamrostam

Comparison

BENCHMARKFORK_JOIN_EXECUTOR_DEFAULT_FORK_JOIN_POLICY_ALLOCATORPARALLEL_EXECUTOR_DEFAULT_PARALLEL_POLICY_ALLOCATORSCHEDULER_EXECUTOR_DEFAULT_SCHEDULER_EXECUTOR_ALLOCATOR
Stream Benchmark - Add(=)---
Stream Benchmark - Scale(=)----
Stream Benchmark - Triad(=)---
Stream Benchmark - Copy(=)+++++

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T18:50:37+00:002026-05-19T16:32:11+00:00
HPX Commitba89f5d283e4a5
Envfile
Datetime2026-03-09T17:49:10.837937-05:002026-05-19T21:06:52.301063-05:00
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Clusternamerostamrostam

Explanation of Symbols

SymbolMEANING
=No performance change (confidence interval within ±1%)
(=)Probably no performance change (confidence interval within ±2%)
(+)/(-)Very small performance improvement/degradation (≤1%)
+/-Small performance improvement/degradation (≤5%)
++/--Large performance improvement/degradation (≤10%)
+++/---Very large performance improvement/degradation (>10%)
?Probably no change, but quite large uncertainty (confidence interval with ±5%)
??Unclear result, very large uncertainty (±10%)
???Something unexpected…

Copy link
Copy Markdown
Contributor

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@hkaiser
Copy link
Copy Markdown
Contributor

hkaiser commented May 20, 2026

@arpittkhandelwal Have you tested this? And if yes, how?

@hkaiser hkaiser added this to the 2.0.0 milestone May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants