Commit e65c21e48ba for woocommerce
commit e65c21e48ba0f0a92897cf82d9e18d3d0bc592cb
Author: Jamel Noel Reid <MrJnrman@users.noreply.github.com>
Date: Tue Oct 6 18:17:01 2026 -0500
Pin .nvmrc to the Node version pnpm runs and check the two agree in CI (#69262)
* [TESTOPS-296] Pin .nvmrc to the Node version pnpm runs and check the two agree in CI
nvm and actions/setup-node read .nvmrc (was the floating v24), pnpm runs scripts under useNodeVersion (24.15.0). Pin .nvmrc to the same version and fail the dependency-validation job when the two differ.
* [TESTOPS-296] Show the syncpack advice only when syncpack failed
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index aa5febe346c..021fe3af716 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -97,7 +97,7 @@ jobs:
- '.github/workflows/scripts/docs-link-check-policy-test.sh'
- '.github/workflows/scripts/install-lychee.sh'
needs-syncpack-validation:
- - '(.syncpackrc)|(pnpm-lock.yaml)|(pnpm-workspace.yaml)'
+ - '(.syncpackrc)|(pnpm-lock.yaml)|(pnpm-workspace.yaml)|(.nvmrc)'
project-jobs:
# Since this is a monorepo, not every pull request or change is going to impact every project.
@@ -693,6 +693,15 @@ jobs:
steps:
- uses: 'actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0' # v7.0.0
+ - name: 'Validate - Node version sources agree'
+ run: |
+ nvmrc="$(tr -d 'v[:space:]' < .nvmrc)"
+ workspace="$(sed -nE "s/^useNodeVersion:[[:space:]]*['\"]?([^'\"#[:space:]]+).*/\1/p" pnpm-workspace.yaml)"
+ if [ -z "$nvmrc" ] || [ -z "$workspace" ] || [ "$nvmrc" != "$workspace" ]; then
+ echo "::error::.nvmrc ($nvmrc) and useNodeVersion in pnpm-workspace.yaml ($workspace) must name the same Node version."
+ exit 1
+ fi
+
- name: 'Setup - node'
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
@@ -702,10 +711,11 @@ jobs:
run: npm install -g syncpack@15.3.3
- name: 'Validate - mismatches'
+ id: syncpack
run: syncpack lint
- name: 'Validate - prompt mitigation on failed validation'
- if: failure()
+ if: ${{ !cancelled() && steps.syncpack.outcome == 'failure' }}
run: |
echo "Dependency version mismatch detected. This can usually be fixed automatically by updating the dependency version in \`.syncpackrc\` or \`pnpm-workspace.yaml\`, then running: \`pnpm sync-dependencies\`"
exit 1
diff --git a/.nvmrc b/.nvmrc
index 54c65116f15..5bf4400f229 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1 +1 @@
-v24
+24.15.0
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 94e0f971443..b60c6f8809c 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -1,3 +1,4 @@
+# Keep equal to .nvmrc: nvm and actions/setup-node read .nvmrc, pnpm uses this one for every pnpm command. CI fails when they differ. On a major bump also update the engines.node range in .syncpackrc.
useNodeVersion: 24.15.0
catalogs: