Repository navigation
chore: sync standards components #363
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Require Checks | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| # `edited`, `labeled` and `unlabeled` can change the pr-title / | |
| # do-not-merge / issue-linkage answers without a new commit, so the required | |
| # check has to re-evaluate. Whether such an event is CONTRACT-ONLY (lanes | |
| # gated off, ci-status carrying the recorded `ci-lanes` verdict forward) is | |
| # decided by one predicate, repeated verbatim in `concurrency.group` and in | |
| # every job's `if:` except `ci-status`: | |
| # | |
| # github.event.pull_request.head.repo.full_name == github.repository && | |
| # (contains(fromJSON('["labeled","unlabeled"]'), github.event.action) || | |
| # (github.event.action == 'edited' && !github.event.changes.base)) | |
| # | |
| # An `edited` event carrying `changes.base` is a BASE-BRANCH change: the | |
| # merge commit the lanes test changes with it, so that runs in full. A fork | |
| # pull request is never contract-only — its token is read-only on | |
| # `pull_request` whatever `permissions:` requests, so it cannot record lane | |
| # state — and runs the full workflow on every event exactly as before. | |
| types: [opened, synchronize, reopened, edited, labeled, unlabeled] | |
| permissions: | |
| contents: read | |
| # The concurrency GROUP branches on the contract-only predicate (ci-perf Phase | |
| # 6b); `cancel-in-progress` is a plain `true` because it takes one value per | |
| # workflow and cannot branch. | |
| # | |
| # Contract-only branch: `ci-contract-<pr>-<run_id>`, unique per run. No | |
| # contract-only run can be canceled, evict anything, or be evicted. That is | |
| # deliberate. Eviction of a *pending* run is unconditional in GitHub's queuing | |
| # ("any existing pending job or workflow in the same concurrency group will be | |
| # canceled") and is NOT governed by `cancel-in-progress`, so the old shared | |
| # group let one contract-only event evict another and leave a check suite on the | |
| # current head with no `ci-status` check run at all, a required check that stops | |
| # reporting until someone re-runs that specific run (dotfiles#647, 2h14m | |
| # silent). Uniqueness costs a burst of one-job runs when labels flip repeatedly, | |
| # seconds each, writing nothing. | |
| # | |
| # Full branch: `<workflow>-<pr number || run_id>` with cancel-in-progress true, | |
| # so a `synchronize` still cancels the run it supersedes. Keying PRs on the | |
| # number (not head_ref) keeps fork PRs that share a branch name from canceling | |
| # each other's required runs. The fallback term is the per-repository push | |
| # decision: `github.run_id` gives every push its own group and therefore no | |
| # push-side burst collapse, which is this repository's existing behavior. The | |
| # `github.event_name == 'pull_request'` guard the old `cancel-in-progress` | |
| # carried is gone with it. | |
| # | |
| # 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 with `yield-to-full-run`: a | |
| # contract-only run fails at once while a full run on the same head SHA is in | |
| # flight; see the 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 | |
| # request number, which does not vary with the head SHA, so re-running a STALE | |
| # run on a superseded head SHA lands in the CURRENT head's group and cancels the | |
| # run that is actually reporting. Re-run the run on the current head instead. | |
| # Contract-only runs are immune, being unique per `github.run_id`. | |
| concurrency: | |
| group: >- | |
| ${{ (github.event.pull_request.head.repo.full_name == github.repository && | |
| (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.run_id) }} | |
| cancel-in-progress: true | |
| jobs: | |
| validate-marketplace: | |
| name: Validate Marketplace | |
| if: ${{ !(github.event.pull_request.head.repo.full_name == github.repository && (contains(fromJSON('["labeled","unlabeled"]'), github.event.action) || (github.event.action == 'edited' && !github.event.changes.base))) }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Node | |
| uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version-file: .node-version | |
| - name: Run validator tests | |
| run: npm test | |
| - name: Validate the marketplace | |
| run: npm run validate | |
| lychee: | |
| name: Lychee | |
| if: ${{ !(github.event.pull_request.head.repo.full_name == github.repository && (contains(fromJSON('["labeled","unlabeled"]'), github.event.action) || (github.event.action == 'edited' && !github.event.changes.base))) }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Check local links and anchors | |
| uses: melodic-software/ci-workflows/.github/actions/lychee-offline@6229c34785ae13489b64574d697437dca68c4f5e # v0.77.0 | |
| with: | |
| config: lychee.toml | |
| ci-status: | |
| name: CI Status | |
| needs: [validate-marketplace, lychee] | |
| if: ${{ !cancelled() }} | |
| runs-on: ubuntu-24.04 | |
| # 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 | |
| # branch reads back on the next contract-only event. | |
| pull-requests: write | |
| statuses: write | |
| # 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: | |
| # 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 <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 | |
| id: report | |
| uses: melodic-software/ci-workflows/.github/actions/pr-require-checks/report-ci-status@6229c34785ae13489b64574d697437dca68c4f5e # v0.77.0 | |
| with: | |
| step-name: Aggregate lane results | |
| results: ${{ join(needs.*.result, ' ') }} | |
| # 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 |