Add build plugin to check Node versions#3917
Open
mbg wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a build-time check to ensure all JavaScript-based GitHub Actions in this repo use a consistent runs.using Node version, and introduces .nvmrc as the single source of truth for workflows to read/compare versions.
Changes:
- Add an esbuild
onStartplugin inbuild.mjsto scanaction.ymlfiles, verify a single Node version is used, and write that version to.nvmrc. - Add
.nvmrc(currently24) to pin the repo’s Node version. - Update
pr-checks.ymlto use.nvmrcfor the backport Node-version check and shorten the job timeout.
Show a summary per file
| File | Description |
|---|---|
| build.mjs | Adds a build plugin that validates runs.using Node versions and writes .nvmrc. |
| .nvmrc | Introduces a pinned Node version file (24). |
| .github/workflows/pr-checks.yml | Switches the backport Node-version check to compare .nvmrc and adjusts job conditions/timeouts. |
Copilot's findings
Comments suppressed due to low confidence (1)
.github/workflows/pr-checks.yml:137
- Same issue here:
actions/checkoutexpectsfetch-depth, notdepth, so this input will be ignored.
uses: actions/checkout@v6
with:
ref: ${{ env.BASE_REF }}
depth: 1
- Files reviewed: 3/3 changed files
- Comments generated: 5
Comment on lines
+119
to
+123
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| depth: 1 | ||
|
|
Comment on lines
124
to
129
| - id: head-version | ||
| name: Verify all Actions use the same Node version | ||
| name: Determine Node version for HEAD | ||
| run: | | ||
| NODE_VERSION=$(find . -name "action.yml" -exec yq -e '.runs.using' {} \; | grep node | sort | uniq) | ||
| NODE_VERSION=$(cat .nvmrc) | ||
| echo "NODE_VERSION: ${NODE_VERSION}" | ||
| if [[ $(echo "$NODE_VERSION" | wc -l) -gt 1 ]]; then | ||
| echo "::error::More than one node version used in 'action.yml' files." | ||
| exit 1 | ||
| fi | ||
| echo "node_version=${NODE_VERSION}" >> $GITHUB_OUTPUT |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a plugin to
build.mjswhich checks that all the Node versions in theaction.ymlfiles for JavaScript-based actions are the same.Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Environments:
How did/will you validate this change?
pr-checks).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist