From 2f2a1f7badb14791284563b1b3e14f3724f0b436 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Wed, 18 Nov 2026 15:21:36 -0500 Subject: [PATCH] ci: move ci-status onto the shared report-ci-status composite The contract check and lane aggregation become one report-ci-status step pinned at ci-workflows v0.76.0, with a step that fails the job on the contract or draft output. The draft policy stays allow. The push fallback in the concurrency group moves from github.ref to github.run_id, so every push to main keeps its own result. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Vcupoo79EqmECYFZ4MTv6C --- .github/workflows/pr-require-checks.yml | 80 +++++++++++++------------ 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/.github/workflows/pr-require-checks.yml b/.github/workflows/pr-require-checks.yml index 41ebd4c..60cca02 100644 --- a/.github/workflows/pr-require-checks.yml +++ b/.github/workflows/pr-require-checks.yml @@ -54,24 +54,22 @@ permissions: # silent). Uniqueness costs a burst of one-job runs when labels flip # repeatedly, seconds each, writing nothing. # -# Full branch: `-` with cancel-in-progress +# Full branch: `-` with cancel-in-progress # true, so a `synchronize` still cancels the run it supersedes. Keying pull # requests on the number (not head_ref) keeps fork pull requests that share a -# branch name from cancelling each other's required runs. The fallback term is -# the per-repository push decision, and this repository keeps `github.ref`: a -# push, `merge_group` or `workflow_dispatch` run has no pull request number, so -# every push to `main` shares one group and a newer push collapses the burst, -# which is the existing behavior (2 cancelled superseded push runs in the 30 -# days to 2026-09-05). The `github.event_name == 'pull_request'` guard the old +# branch name from cancelling each other's required runs. A push, +# `merge_group` or `workflow_dispatch` run has no pull request number and falls +# back to `github.run_id`, so every push to `main` keeps its own result. The +# `github.event_name == 'pull_request'` guard the old # `cancel-in-progress` expression carried is gone: the predicate is false on # every non-pull-request event anyway, since `github.event.pull_request` is # null there. # # The cost of the branch: a contract-only run no longer queues behind the full # run whose `ci-lanes` status it carries forward, so the two race. The -# `aggregate-results` composite closes that by failing the contract-only run at -# once while an earlier full run on the same head SHA is incomplete; see -# `yield-to-full-run` on the job below. +# `report-ci-status` composite closes that by failing the contract-only run at +# once while an earlier full run on the same head SHA is incomplete; see the +# `ci-status` job below. # # One hazard the branch does not remove, because no concurrency setting both # removes it and keeps supersession: the full branch is keyed on the pull @@ -85,7 +83,7 @@ concurrency: (contains(fromJSON('["labeled","unlabeled"]'), github.event.action) || (github.event.action == 'edited' && !github.event.changes.base))) && format('ci-contract-{0}-{1}', github.event.pull_request.number, github.run_id) - || format('{0}-{1}', github.workflow, github.event.pull_request.number || github.ref) }} + || format('{0}-{1}', github.workflow, github.event.pull_request.number || github.run_id) }} cancel-in-progress: true jobs: @@ -283,16 +281,17 @@ jobs: needs: [test-shell, psscriptanalyzer, validate-manifests, check-links, lychee, typos] if: ${{ !cancelled() }} runs-on: ubuntu-24.04 - # No run waits for another: with `yield-to-full-run` a contract-only run - # lists in-flight runs once and reads the status once, and a full run's - # ci-status runs after its lanes, so either finishes in seconds. + # No run waits for another: a contract-only run lists in-flight runs once + # and reads the status once, and a full run's ci-status runs after its + # lanes, so either finishes in seconds. timeout-minutes: 3 permissions: contents: read - # `yield-to-full-run` lists this workflow's runs on the head SHA, and - # `rerun-contract-only-siblings` re-runs the red contract-only ones once - # the full run records `success`. Under an explicit `permissions:` block - # every unlisted scope defaults to none; write covers the read. + # The composite lists this workflow's runs on the head SHA (its fixed + # `yield-to-full-run`) and re-runs the red contract-only ones once the + # full run records `success` (`rerun-contract-only-siblings`). Under an + # explicit `permissions:` block every unlisted scope defaults to none; + # write covers the read. actions: write # check-contract upserts the advisory linkage comment and moves the linkage # label; ci-status records the `ci-lanes` commit status the carry-forward @@ -300,27 +299,30 @@ jobs: pull-requests: write statuses: write steps: - - name: Check the pull-request contract - uses: melodic-software/ci-workflows/.github/actions/pr-require-checks/check-contract@24067add42f5fa04743c587c6a22aa7d4059e7b8 # v0.75.0 - with: - token: ${{ github.token }} + # The contract, the draft policy and the aggregation in one step. The + # step keeps the aggregation step's old name: a contract-only run finds + # the writer step of the full run it carries forward by this name. + # The composite fixes `yield-to-full-run: 'true'` and + # `carry-forward-wait-seconds: '0'`, the values this job set before + # (https://github.com/melodic-software/ci-workflows/blob/ebd0e3bed99ae1365fcb4ef47ce97cfa745fcf2f/.github/actions/pr-require-checks/report-ci-status/action.yml#L128-L129): + # a contract-only run never waits; while a full run on the SHA is in + # flight it fails with "superseded by full run ", and once that run + # records `success` it re-runs the red contract-only runs + # (`rerun-contract-only-siblings`, default `true`). `treat-skipped-as` + # stays at its default `fail`, as before: a skipped lane is red. - name: Aggregate lane results - # `!cancelled()` so a failing check-contract step does not skip the - # aggregation: the job still fails on the contract step's exit code, and - # the `ci-lanes` status is on the SHA for the next contract-only run. - if: ${{ !cancelled() }} - uses: melodic-software/ci-workflows/.github/actions/pr-require-checks/aggregate-results@24067add42f5fa04743c587c6a22aa7d4059e7b8 # v0.75.0 + id: report + uses: melodic-software/ci-workflows/.github/actions/pr-require-checks/report-ci-status@ebd0e3bed99ae1365fcb4ef47ce97cfa745fcf2f # v0.76.0 with: + step-name: Aggregate lane results results: ${{ join(needs.*.result, ' ') }} - # The replaced inline aggregator passed only `success`, so a `skipped` - # lane was already red here. - treat-skipped-as: fail - # A contract-only run never waits: while a full run on the SHA is in - # flight it fails with "superseded by full run ", and that run's - # newer ci-status decides the gate. Once the full run records - # `success` it re-runs those red contract-only runs, which then read - # the `success` and replace their red check runs. - yield-to-full-run: 'true' - rerun-contract-only-siblings: 'true' - carry-forward-wait-seconds: '0' - token: ${{ github.token }} + # This workflow is not draft-gated (no `ready_for_review` trigger), so a draft passes. + draft: allow + # The composite's step concludes on the lanes alone; the contract and + # draft results fail the job here. Anything but `success` fails, so an + # empty or renamed output fails closed. + - name: Fail on the contract or draft policy + if: ${{ !cancelled() && (steps.report.outputs.contract != 'success' || steps.report.outputs.draft != 'success') }} + run: | + echo "::error::ci-status: the pull-request contract or the draft policy failed; see the step above." + exit 1