Skip to content

Cancel the runs of merged pull requests when they merge - #75683

Merged
shahar1 merged 1 commit into
mainfrom
cancel-merged-pr-runs-on-push
Oct 26, 2026
Merged

shahar1 merged 1 commit into
mainfrom
cancel-merged-pr-runs-on-push

Conversation

@potiuk

@potiuk potiuk commented Oct 26, 2026

Copy link
Copy Markdown
Member

Moves the cancelling of merged pull requests' runs from the fork CI monitor's 15-minute schedule to a workflow triggered by the merge itself, as recommended in apache/infrastructure-website#323. Until now a merged pull request's runs kept holding runners for up to 15 minutes, and stuck ones for 30 more before being force-cancelled.

cancel-merged-pr-runs.yml runs on push to the branches pull requests merge into. It looks up the merged pull request of the pushed commit and cancels its unfinished pull_request runs created before the merge, matched by head repository and commit so fork pull requests are covered too. It skips heads still used by an open pull request, and force-cancels runs still going five minutes later. The lookup retries for up to a minute, since GitHub associates the merge commit with its pull request a few seconds after the push. It runs on ubuntu-slim with gh only, without installing Breeze, so it cancels within about a minute of the merge.

The scheduled implementation from #75619 is reverted (module, tests, cancel_merged_runs config flag and the reconciler hook), and the design moves from the fork CI document to 05_workflows.md.

A push runs the workflow file of the pushed branch, so release branches need the workflow backported to get the same behaviour.

Checks run locally: fork-CI breeze tests (419 passed), shellcheck of the workflow script, prek hooks on the changed files (all passed except lychee, which needs Docker). The script was dry-run (cancel calls replaced by echo) against recent merges of fork and in-repo pull requests and matched their runs; a failed lookup fails the job.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Opus 5

Generated-by: Claude Opus 5 following the guidelines

🤖 Generated with Claude Code

The fork CI monitor cancelled them on its 15-minute schedule, so runs of a
merged pull request kept holding runners for up to 15 minutes, and stuck
ones for 30 more before being force-cancelled. Merging pushes to the target
branch, which lets a push-triggered workflow find the merged pull request
directly and cancel its runs right away, without the monitor's search over
every unfinished run.

Generated-by: Claude Opus 5
@shahar1
shahar1 merged commit bfb620d into main Oct 26, 2026
191 checks passed
@shahar1
shahar1 deleted the cancel-merged-pr-runs-on-push branch October 26, 2026 18:48
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-4-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ v3-4-test PR Link

github-actions Bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Oct 26, 2026
…pache#75683)

The fork CI monitor cancelled them on its 15-minute schedule, so runs of a
merged pull request kept holding runners for up to 15 minutes, and stuck
ones for 30 more before being force-cancelled. Merging pushes to the target
branch, which lets a push-triggered workflow find the merged pull request
directly and cancel its runs right away, without the monitor's search over
every unfinished run.
(cherry picked from commit bfb620d)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
Generated-by: Claude Opus 5
potiuk added a commit that referenced this pull request Oct 26, 2026
…75683) (#75687)

The fork CI monitor cancelled them on its 15-minute schedule, so runs of a
merged pull request kept holding runners for up to 15 minutes, and stuck
ones for 30 more before being force-cancelled. Merging pushes to the target
branch, which lets a push-triggered workflow find the merged pull request
directly and cancel its runs right away, without the monitor's search over
every unfinished run.
(cherry picked from commit bfb620d)


Generated-by: Claude Opus 5

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants