Repository navigation
ci: repin ci-workflows to v0.39.0 #45
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: Marketplace contracts | |
| 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@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version-file: .node-version | |
| - name: Run validator tests | |
| run: npm test | |
| - name: Validate the marketplace | |
| run: npm run validate | |
| ci-status: | |
| needs: [validate-marketplace] | |
| 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. | |
| 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 | |
| # `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. | |
| actions: write | |
| steps: | |
| - name: Check the pull-request contract | |
| uses: melodic-software/ci-workflows/.github/actions/pr-require-checks/check-contract@6ba73b97b058602c4dd2bb6e2cce234d11011787 # v0.39.0 | |
| with: | |
| token: ${{ github.token }} | |
| - 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@6ba73b97b058602c4dd2bb6e2cce234d11011787 # v0.39.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' | |
| 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 }} |