Skip to content

chore(ci): cancel in-flight E2E install runs when a PR is closed#86

Merged
ChipWolf merged 1 commit into
mainfrom
wolf/e2e-cancel-on-close
May 19, 2026
Merged

chore(ci): cancel in-flight E2E install runs when a PR is closed#86
ChipWolf merged 1 commit into
mainfrom
wolf/e2e-cancel-on-close

Conversation

@ChipWolf
Copy link
Copy Markdown
Owner

Summary

Apply the cancel-on-close pattern already used by megalinter.yml to e2e-install.yml:

  1. Add closed to the pull_request types filter.
  2. Add a concurrency group keyed on ${{ github.head_ref || github.ref }} with cancel-in-progress: true.
  3. Gate each of the three jobs (Linux / Windows / macOS) on if: github.event.action != 'closed'.

How it works

When a PR is closed, GitHub queues a new workflow run with action: closed. Because it shares the concurrency group with the in-flight run, cancel-in-progress: true cancels the in-flight run. The new run starts but every job's if evaluates false, so all jobs skip and the run completes immediately as "skipped".

Net effect: closing a PR (merge or otherwise) terminates the slow E2E install jobs instead of letting them burn Linux/Windows/macOS runner minutes after the result is moot.

Test plan

  • Open a PR that touches a path the workflow watches, push enough to start E2E jobs, then close the PR — confirm the in-flight Linux/Windows/macOS jobs cancel within ~1 minute.
  • Confirm normal open/synchronize/reopen events still run all three jobs.
  • workflow_dispatch still runs (no action field → null != 'closed' is true).

🤖 Generated with Claude Code

Mirror the cancel-on-close pattern already used by megalinter.yml:

- Add `closed` to the pull_request types so a PR close re-fires the
  workflow.
- Add a concurrency group keyed on the PR head ref with
  cancel-in-progress: true, so the new close-triggered run cancels any
  in-flight run on the same branch.
- Gate each job on `github.event.action != 'closed'`, so the
  close-triggered run is a no-op (its job is skipped) and only serves
  to cancel the previous run.

Net effect: closing the PR halts the slow Linux/Windows/macOS E2E jobs
instead of letting them burn runner minutes after the work is moot.
@ChipWolf ChipWolf merged commit 6aee9a5 into main May 19, 2026
2 of 6 checks passed
@ChipWolf ChipWolf deleted the wolf/e2e-cancel-on-close branch May 19, 2026 11:29
@github-actions github-actions Bot mentioned this pull request May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant