cancel-superseded.yml
Cancels the queued and running workflow runs of a pull request that were started for a head the pull request no longer has, and, once the pull request closes, the runs started before it closed. This implements gha#1400.
Runs started at or after the close are left alone, so a closed workflow such as preview teardown still runs.
Inputs
| Input | Default | Meaning |
|---|---|---|
runs-on |
vars.CI_RUNNER in a private repository that sets it; otherwise ubuntu-latest |
Runner label for the job |
Permissions
The caller grants actions: write and pull-requests: read.
Limits
- GitHub lists no pull request for a run from a fork, so fork pull requests are never matched.
- Runs in
waitingorrequestedstatus are not cancelled. - Fork and Dependabot pull requests get a read-only token, which cannot cancel runs.
- GitHub runs no
pull_requestworkflow while a pull request has merge conflicts, so the caller does not fire, and nothing is cancelled, until the conflict is resolved. - On a self-hosted runner pool (
CI_RUNNER), the cancel job queues for a runner like any other job, so it can wait behind the very runs it should cancel. Setruns-onto a label with a free runner if that delay matters.