[actions] fall back to the canonical nvmrc submodule when a fork lacks its own

Upstream's `.gitmodules` uses a relative submodule url (`../nvmrc.git`),
which resolves against the superproject's origin:
on a fork without its own `nvmrc` fork that is `<owner>/nvmrc`,
which 404s and fails `actions/checkout` with `submodules: true`.
Keep `submodules: true` (so a fork's own `nvmrc` is used when present),
but mark checkout `continue-on-error` and, only when it failed,
re-point the submodule at `nvm-sh/nvmrc` and update.
This commit is contained in:
Jordan Harband
2026-06-04 09:22:04 -07:00
parent 1889911f08
commit 77fca77ddd
4 changed files with 36 additions and 0 deletions

View File

@@ -42,8 +42,17 @@ jobs:
registry-1.docker.io:443
auth.docker.io:443
- uses: actions/checkout@v6
id: checkout
continue-on-error: true
with:
submodules: true
- name: 'nvmrc submodule fallback (forks without their own nvmrc)'
if: steps.checkout.outcome == 'failure'
shell: bash
run: |
git submodule set-url test/fixtures/nvmrc https://github.com/nvm-sh/nvmrc.git
git submodule sync --recursive
git submodule update --init --recursive
- uses: ljharb/actions/node/install@main
name: 'npm install && version checks'
with: