mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 14:30:52 +00:00
refactor(ci): derive the manual cancel override from the event
force_cancel_in_progress existed so a manual sweep could supersede a running orchestrator on any ref. It was a flag every caller had to remember to pass, and only one ever did. A called workflow inherits github.event_name from its caller, so the orchestrator can see for itself that a human dispatched the run. The input is gone; the group reads the event instead. Automatic triggers keep following the ref alone -- everything but main -- and a manual dispatch supersedes everywhere, main included, because someone typed it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e3d91fd8b2
commit
e4353d9742
4 files changed
+5
-11
No files matched your search
@@ -87,15 +87,10 @@ on:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
force_cancel_in_progress:
|
||||
description: "When true, a new run always cancels the running orchestrator on the same ref, including on main, which is otherwise never cancelled."
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
concurrency:
|
||||
group: infinito-test-${{ github.ref }}
|
||||
cancel-in-progress: ${{ inputs.force_cancel_in_progress || github.ref != 'refs/heads/main' }}
|
||||
cancel-in-progress: ${{ github.event_name == 'workflow_dispatch' || github.ref != 'refs/heads/main' }}
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
|
||||
@@ -123,5 +123,4 @@ jobs:
|
||||
workspace_track: ${{ inputs.workspace_track }}
|
||||
instructions: ${{ inputs.instructions }}
|
||||
tor: ${{ inputs.tor }}
|
||||
force_cancel_in_progress: true
|
||||
secrets: inherit
|
||||
@@ -127,8 +127,8 @@ The final `done` job aggregates all deploy, install, and development gates. CI i
|
||||
## Concurrency 🔀
|
||||
|
||||
- PR pipelines use `cancel-in-progress: true` so only the newest run per PR and event type is active. The group does not always reap a long orchestrator sweep, which then leaves the newer run parked on `pending`; [entry-cancel-superseded.yml](../../../../.github/workflows/entry-cancel-superseded.yml) cancels those leftovers through the API, see [cancel/README.md](../../../../scripts/github/cancel/README.md).
|
||||
- The orchestrator and the push entry workflow (`entry-push-latest.yml`) cancel in-progress runs on every ref except `main`, which is never cancelled. A `pull_request_target` run inherits `refs/heads/main` as its ref, so the orchestrator does not cancel there either; per-PR supersession is handled by the entry workflow's own `pr-ci-*` group. See [configuration.md](../../tools/github/actions/configuration.md).
|
||||
- The manual entry workflow (`entry-manual-steer.yml`) sets `cancel-in-progress: true` on its own group and passes `force_cancel_in_progress: true` into the orchestrator, so a manual run cancels on both levels, `main` included.
|
||||
- The orchestrator and the push entry workflow (`entry-push-latest.yml`) cancel in-progress runs on every ref except `main`, which no automatic trigger cancels. A `pull_request_target` run inherits `refs/heads/main` as its ref, so the orchestrator does not cancel there either; per-PR supersession is handled by the entry workflow's own `pr-ci-*` group. See [configuration.md](../../tools/github/actions/configuration.md).
|
||||
- The manual entry workflow (`entry-manual-steer.yml`) sets `cancel-in-progress: true` on its own group, and the orchestrator's group cancels for `workflow_dispatch` regardless of ref, so a manual sweep supersedes on both levels, `main` included.
|
||||
|
||||
See [configuration.md](../../tools/github/actions/configuration.md) for all repository variables that control CI behaviour.
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Repository variables are set under **Settings → Secrets and variables → Acti
|
||||
|
||||
## Cancelling in-progress runs 🛑
|
||||
|
||||
Not a variable: cancellation is keyed on the ref. Every run on a branch other than `main` is cancelled by a newer run in the same concurrency group; runs on `main` are not, because a half-finished pipeline on the default branch is worse than a queued one. The one exception is a manual dispatch, which supersedes everywhere — see below.
|
||||
Not a variable: cancellation is derived from the trigger. Every automatic run on a branch other than `main` is cancelled by a newer run in the same concurrency group; automatic runs on `main` are not, because a half-finished pipeline on the default branch is worse than a queued one. A manual dispatch always supersedes, `main` included: someone typed it, so it is the intent that counts, not the ref.
|
||||
|
||||
```yaml
|
||||
cancel-in-progress: ${{ github.ref_name != 'main' }}
|
||||
@@ -27,7 +27,7 @@ cancel-in-progress: ${{ github.ref_name != 'main' }}
|
||||
|
||||
[call-orchestrator.yml](../../../../../.github/workflows/call-orchestrator.yml) compares `github.ref` for the same reason: a called workflow inherits the caller's ref, which is `refs/pull/<n>/merge` for a `pull_request` caller but `refs/heads/main` for a `pull_request_target` one. The `ci-orchestrator` job of `entry-pr-change-orchestrate.yml` is fenced to `github.event_name == 'pull_request'`, so the ref the orchestrator sees from that caller is always the merge ref; widening that fence would silently put fork runs into main's group.
|
||||
|
||||
The manual entry workflow overrides the rule deliberately: its own group is `cancel-in-progress: true`, and it passes `force_cancel_in_progress: true` into the orchestrator, so a manual sweep supersedes a running one even on `main`.
|
||||
`entry-manual-steer.yml` declares `cancel-in-progress: true` outright on its own group, and the orchestrator reads `github.event_name` — which a called workflow inherits from its caller — so a manual sweep supersedes on both levels without an input to pass down.
|
||||
|
||||
## `CI_SYNC_MAIN_SOURCE_REPOSITORY` 🔄
|
||||
|
||||
|
||||
Reference in new issue
Block a user