-
Notifications
You must be signed in to change notification settings - Fork 7
ci: own the setup, changelog, and merge-queue steps instead of calling out for them #1044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sirtimid
merged 1 commit into
sirtimid/pin-workflow-actions
from
sirtimid/vendor-ci-actions
Sep 8, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| name: Check skip merge queue | ||
| description: >- | ||
| Report whether the pull request in a merge group is first in the queue and | ||
| already up to date with the base branch, in which case the checks about to run | ||
| would test a commit nothing has changed under. | ||
|
|
||
| Only the report is produced here. Nothing can make the merge queue skip an | ||
| entry from inside a workflow, so callers gate their own jobs on the output. | ||
|
|
||
| # Ported from MetaMask/github-tools/.github/actions/check-skip-merge-queue, | ||
| # which calls actions/github-script by mutable tag. See the note in | ||
| # ../checkout-and-setup/action.yml for why that cannot be pinned from outside. | ||
|
|
||
| inputs: | ||
| head-ref: | ||
| description: The merge group's head ref, which carries the pull request number. | ||
| required: true | ||
| default: ${{ github.event.merge_group.head_ref }} | ||
| base-ref: | ||
| description: The branch the pull request is merging into. | ||
| required: true | ||
| default: main | ||
| github-token: | ||
| description: The token used to read the pull request and compare branches. | ||
| required: true | ||
| default: ${{ github.token }} | ||
|
|
||
| outputs: | ||
| up-to-date: | ||
| description: >- | ||
| Whether the pull request is first in the queue and up to date with the | ||
| base branch. `false` whenever that cannot be established, so a failure | ||
| here costs a redundant run rather than an untested merge. | ||
| value: ${{ steps.up-to-date.outputs.up-to-date || 'false' }} | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| # `continue-on-error` on both steps: this is an optimization, and the safe | ||
| # answer is always available. A throw here leaves `up-to-date` empty, which | ||
| # the output above reads as `false`. | ||
| - name: Find the pull request behind the merge group | ||
| continue-on-error: true | ||
| id: pr-details | ||
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | ||
| env: | ||
| HEAD_REF: ${{ inputs.head-ref }} | ||
| with: | ||
| github-token: ${{ inputs.github-token }} | ||
| script: | | ||
| const { HEAD_REF } = process.env; | ||
| const match = HEAD_REF.match(/\/pr-([0-9]+)-/u); | ||
| if (!match) { | ||
| return core.setFailed(`Could not extract pull request number from head ref: "${HEAD_REF}".`); | ||
| } | ||
|
|
||
| const number = parseInt(match[1], 10); | ||
| const result = await github.graphql(` | ||
| query($owner: String!, $name: String!, $number: Int!) { | ||
| repository(owner: $owner, name: $name) { | ||
| pullRequest(number: $number) { | ||
| headRefName | ||
| mergeQueueEntry { position } | ||
| } | ||
| } | ||
| } | ||
| `, { | ||
| owner: context.repo.owner, | ||
| name: context.repo.repo, | ||
| number, | ||
| }); | ||
|
|
||
| if (!result.repository.pullRequest) { | ||
| return core.setFailed(`Pull request #${number} not found in repository "${context.repo.owner}/${context.repo.repo}".`); | ||
| } | ||
|
|
||
| const position = result.repository.pullRequest.mergeQueueEntry?.position; | ||
| if (!position) { | ||
| return core.setFailed(`Pull request #${number} is not in the merge queue.`); | ||
| } | ||
|
|
||
| core.setOutput('pr-number', number); | ||
| core.setOutput('pr-branch', result.repository.pullRequest.headRefName); | ||
| core.setOutput('merge-queue-position', position); | ||
|
|
||
| - name: Check whether it is up to date with the base branch | ||
| continue-on-error: true | ||
| id: up-to-date | ||
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | ||
| env: | ||
| BASE_REF: ${{ inputs.base-ref }} | ||
| PR_BRANCH: ${{ steps.pr-details.outputs.pr-branch }} | ||
| MERGE_QUEUE_POSITION: ${{ steps.pr-details.outputs.merge-queue-position }} | ||
| with: | ||
| github-token: ${{ inputs.github-token }} | ||
| script: | | ||
| const { BASE_REF, PR_BRANCH, MERGE_QUEUE_POSITION } = process.env; | ||
|
|
||
| // Only the first entry can be up to date with the base branch by | ||
| // definition; anything behind it is waiting on merges above it. | ||
| if (parseInt(MERGE_QUEUE_POSITION, 10) !== 1) { | ||
| core.info(`Pull request is not first in the merge queue (position: ${MERGE_QUEUE_POSITION}).`); | ||
| core.setOutput('up-to-date', 'false'); | ||
| return; | ||
| } | ||
|
|
||
| const comparison = await github.rest.repos.compareCommitsWithBasehead({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| basehead: `${BASE_REF}...${PR_BRANCH}`, | ||
| }); | ||
|
|
||
| if (comparison.data.status === 'identical' || comparison.data.status === 'ahead') { | ||
| core.info(`Pull request branch "${PR_BRANCH}" is up-to-date with base branch "${BASE_REF}".`); | ||
| core.setOutput('up-to-date', 'true'); | ||
| } else { | ||
| core.info(`Pull request branch "${PR_BRANCH}" is not up-to-date with base branch "${BASE_REF}".`); | ||
| core.setOutput('up-to-date', 'false'); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| name: Set up environment | ||
| description: Set up Node.js and Yarn and install dependencies, in a repository already checked out. | ||
|
|
||
| # Replaces the setup half of MetaMask/action-checkout-and-setup. That action is | ||
| # pinned by SHA where we call it, but calls actions/checkout, actions/setup-node | ||
| # and actions/cache by mutable tag internally, which this organization refuses -- | ||
| # rightly, since a pin one layer deep is no pin at all. Keeping the steps here is | ||
| # the only way to pin the whole chain, and the chain is short. | ||
| # | ||
| # Checkout is not part of this action and cannot be: `uses: ./...` resolves | ||
| # against the workspace, so the repository has to be on disk before the runner | ||
| # can find this file. Callers check out first, with their own pinned step. | ||
| # | ||
| # Deliberately narrower than the action it replaces: no node_modules cache and | ||
| # no lookup-only fast path, only Yarn's download cache. Those are worth real | ||
| # minutes on a monorepo this size, but they turn on a cache key that has to | ||
| # account for the native rebuilds `postinstall` runs, and getting that subtly | ||
| # wrong yields a job that passes against stale binaries. `yarn install` runs | ||
| # every time here, so what is on disk always matches the lockfile. | ||
|
|
||
| inputs: | ||
| node-version: | ||
| description: The Node.js version to use. Defaults to the one in `.nvmrc`. | ||
| required: false | ||
| default: '' | ||
| cache: | ||
| description: >- | ||
| Whether to restore and save Yarn's download cache. Pass `false` from jobs | ||
| holding publish credentials, where a poisoned entry buys an attacker more | ||
| than the cache saves us. | ||
| required: false | ||
| default: 'true' | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Set up Node.js | ||
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | ||
| with: | ||
| node-version: ${{ inputs.node-version }} | ||
| node-version-file: ${{ inputs.node-version == '' && '.nvmrc' || '' }} | ||
|
|
||
| - name: Enable Corepack | ||
| shell: bash | ||
| run: corepack enable | ||
|
|
||
| # `enableGlobalCache: false` puts Yarn's downloads in `.yarn/cache`, which is | ||
| # gitignored, so without this every job refetches the whole dependency tree. | ||
| # Restoring a partial cache is still worth it, hence `restore-keys`: a | ||
| # lockfile change invalidates the key but leaves most entries reusable. | ||
| - name: Restore Yarn's download cache | ||
| if: inputs.cache == 'true' | ||
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | ||
| with: | ||
| path: .yarn/cache | ||
| key: yarn-${{ runner.os }}-${{ inputs.node-version }}-${{ hashFiles('yarn.lock') }} | ||
| restore-keys: | | ||
| yarn-${{ runner.os }}-${{ inputs.node-version }}- | ||
| yarn-${{ runner.os }}- | ||
|
|
||
| # The LavaMoat plugin in `.yarnrc.yml` runs the scripts `lavamoat.allowScripts` | ||
| # permits, so there is no separate `yarn allow-scripts` step to run. | ||
| - name: Install dependencies | ||
| shell: bash | ||
| run: yarn install --immutable |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Private packages fail changelog presence
Medium Severity
The presence check treats any
packages/*/CHANGELOG.mdas a published package. Several private workspaces ship a changelog from the template, includingagentmask,create-package,kernel-agents,template-package, andsample-services. Edits there now fail this job even thoughyarn changelog:validateskips them with--no-private.Reviewed by Cursor Bugbot for commit 5c2bd57. Configure here.