Skip to content

fix: resolve Node version from action .nvmrc via bash#2

Merged
mmanciop merged 1 commit into
mainfrom
fix/node-version-path
Jul 8, 2026
Merged

fix: resolve Node version from action .nvmrc via bash#2
mmanciop merged 1 commit into
mainfrom
fix/node-version-path

Conversation

@mmanciop

@mmanciop mmanciop commented Jul 8, 2026

Copy link
Copy Markdown
Member

Bug caught by the first live e2e run

Ran the composite action from a throwaway caller (dash0hq/sync-docs-e2e-source), it failed at the first step:

##[error]The specified node version file at:
/home/runner/work/sync-docs-e2e-source/sync-docs-e2e-source/home/runner/work/_actions/dash0hq/sync-docs-action/802854fea6967d26c38b52a41cda2a2ca94e8c4e/.nvmrc
does not exist

Cause: actions/setup-node's node-version-file input is resolved relative to $GITHUB_WORKSPACE, not to github.action_path. The absolute path returned by github.action_path got concatenated with the workspace prefix and produced the gibberish path above.

Fix

Introduce a small bash step that reads the version from the action's own .nvmrc (via ${GITHUB_ACTION_PATH}) into a step output, then pass the literal version string to actions/setup-node via node-version. .nvmrc remains the single source of truth for the Node version required by the engine.

Diff is tiny — one new step, one changed line on the existing setup-node step.

Verification

  • pnpm run lint, format:check, typecheck, test — all still green (87 engine tests + 1 docs-invariants scaffold).
  • Re-running the e2e caller against dash0hq/sync-docs-action@<this-branch-sha> is the actual acceptance test; will confirm once merged.

Follow-up

Once this merges, I'll update the caller pin on dash0hq/sync-docs-e2e-source to the new head-of-main SHA, re-run the e2e workflow, and confirm the whole pipeline runs cleanly against a real caller.

…sion-file

The `actions/setup-node` action's `node-version-file` input is resolved
relative to `$GITHUB_WORKSPACE`, not to `github.action_path`. Passing an
absolute path derived from `github.action_path` produced a concatenated
path like

  /home/runner/work/<caller>/<caller>/home/runner/work/_actions/dash0hq/sync-docs-action/<sha>/.nvmrc

which never resolves. First real e2e run against a caller repo (throwaway
`dash0hq/sync-docs-e2e-source`) failed immediately at this step.

Fix: read the version out of the action's `.nvmrc` in a preceding bash
step (which can dereference `${GITHUB_ACTION_PATH}` correctly) and pass
the literal version string to setup-node via `node-version`. Keeps the
`.nvmrc` in this repo as the single source of truth for the Node
version — devs bump one file, the composite action follows.
@mmanciop mmanciop merged commit 4c237f6 into main Jul 8, 2026
1 check passed
mmanciop added a commit that referenced this pull request Jul 8, 2026
…ckage_json_file

Same class of bug as #2 (Node version): `pnpm/action-setup`'s
`package_json_file` input is resolved relative to `$GITHUB_WORKSPACE`.
Passing an absolute path from `github.action_path` produces a
non-existent file; the action silently falls back to the caller's
package.json (which does not declare `packageManager`) and fails with:

  Error: No pnpm version is specified.
  Please specify it by one of the following ways:
    - in the GitHub Action config with the key "version"
    - in the package.json with the key "packageManager"
    - in the package.json with the key "devEngines.packageManager"

Caught by the second e2e run against dash0hq/sync-docs-e2e-source
(after PR #2 fixed the analogous node-version-file resolution).

Fix: read the version from the action's package.json in a preceding
bash step (Node is on PATH since setup-node just ran) and pass the
literal version string to setup-pnpm via `version`. Consistent with
the pattern PR #2 established for the Node version.

Local verification: pnpm lint, format:check, typecheck, and the 87
engine tests + docs-invariants scaffold test all green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant