|
| 1 | +# CI Run Model |
| 2 | + |
| 3 | +This document defines how pull request checks and release runs are wired together. |
| 4 | + |
| 5 | +## Workflow purpose |
| 6 | + |
| 7 | +| Workflow | Purpose | |
| 8 | +| --- | --- | |
| 9 | +| `ci.yml` | Runs required pull request checks used by branch protection/rulesets. | |
| 10 | +| `ci-post-merge.yml` | Runs post-merge sentinel validation on `main`/`next` pushes. | |
| 11 | +| `release-check.yml` | Performs semantic-release on release branches after required checks have already passed in PR. | |
| 12 | + |
| 13 | +## Trigger matrix |
| 14 | + |
| 15 | +| Event | Branch | `ci.yml` | `ci-post-merge.yml` | `release-check.yml` | |
| 16 | +| --- | --- | --- | --- | --- | |
| 17 | +| `pull_request` | `main`, `next` | ✅ required checks | ❌ | ❌ | |
| 18 | +| `push` | `main`, `next` | ❌ | ✅ post-merge sentinel | ✅ release run | |
| 19 | +| `workflow_dispatch` | selected ref (only `main`/`next` accepted by job validation) | ❌ | ❌ | ✅ manual release run (main/next only) | |
| 20 | + |
| 21 | +> **Constraint:** Although GitHub UI lets you choose any ref for `workflow_dispatch`, `release-check.yml` enforces `main` or `next` only and fails early for other refs. |
| 22 | +
|
| 23 | +## Required checks for repository ruleset |
| 24 | + |
| 25 | +The repository ruleset must require exactly these check names: |
| 26 | + |
| 27 | +- Unit tests on node v22 |
| 28 | +- Code checks on node v22 |
| 29 | + |
| 30 | +These checks are produced by `ci.yml` and must be green before merging to `main` or `next`. |
| 31 | + |
| 32 | +## Release model (no schedule) |
| 33 | + |
| 34 | +Release workflow is lean and intentionally does not run a weekly schedule: |
| 35 | + |
| 36 | +- Push to `next` → prerelease channel |
| 37 | +- Push to `main` → stable release channel |
| 38 | +- Manual `workflow_dispatch` → ad-hoc release from `main` or `next` only (validated in the release job) |
| 39 | + |
| 40 | +Because release runs happen only after merges, quality gates live in PR required checks, not duplicated release-time full matrices. |
| 41 | + |
| 42 | +## Operational verification |
| 43 | + |
| 44 | +Use GitHub CLI to confirm the run model: |
| 45 | + |
| 46 | +```bash |
| 47 | +# CI required checks from PRs |
| 48 | + |
| 49 | +gh run list --workflow ci.yml --event pull_request --limit 20 |
| 50 | + |
| 51 | +# Post-merge sentinel runs on push (next) |
| 52 | + |
| 53 | +gh run list --workflow ci-post-merge.yml --event push --branch next --limit 20 |
| 54 | + |
| 55 | +# Post-merge sentinel runs on push (main) |
| 56 | + |
| 57 | +gh run list --workflow ci-post-merge.yml --event push --branch main --limit 20 |
| 58 | + |
| 59 | +# Release runs on push (main + next) |
| 60 | + |
| 61 | +gh run list --workflow release-check.yml --event push --limit 20 |
| 62 | + |
| 63 | +# Optional manual release runs |
| 64 | + |
| 65 | +gh run list --workflow release-check.yml --event workflow_dispatch --limit 20 |
| 66 | +``` |
| 67 | + |
| 68 | +## Rollback guidance |
| 69 | + |
| 70 | +If the model needs to be reverted quickly: |
| 71 | + |
| 72 | +1. Revert the workflow/ruleset refactor commit. |
| 73 | +2. Confirm ruleset required checks point to existing check names. |
| 74 | +3. Re-run a PR and confirm both required checks appear and pass. |
| 75 | +4. Verify push-based release on `next` and `main` with `gh run list` filters above. |
| 76 | +5. If release is blocked, run `workflow_dispatch` once as a temporary bridge while fixing ruleset/workflow drift. |
0 commit comments