Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 37 additions & 33 deletions .github/workflows/pr-require-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ permissions:
#
# 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's `yield-to-full-run` closes that: a contract-only
# `report-ci-status` composite's fixed `yield-to-full-run` closes that: a contract-only
# run fails at once while a full run on the same head SHA is in flight, and that
# run's newer ci-status decides the gate; see the job below.
#
Expand Down Expand Up @@ -125,46 +125,50 @@ jobs:
needs: [check-scripts-and-manifests, lychee]
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
# check-contract upserts the advisory linkage comment and moves the linkage
# label; ci-status records the `ci-lanes` commit status the carry-forward
# The composite upserts the advisory linkage comment and moves the linkage
# label, and records the `ci-lanes` commit status the carry-forward
# branch reads back on the next contract-only event.
pull-requests: write
statuses: write
# `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
steps:
- name: Check the pull-request contract
# A `push` or `merge_group` run carries no pull-request number, which
# makes this step a no-op reporting every output as `skipped`.
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. A
# `push` or `merge_group` run carries no pull-request number, which makes
# the contract check a no-op.
# 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 <url>", 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:
# A contract-only run never waits: while a full run on the SHA is in
# flight it fails with "superseded by full run <url>", 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'
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
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
Loading