Skip to content

Commit 958b6d5

Browse files
authored
fix(action.yml): use .nvmrc, package.json from action repo (#165)
1 parent b393f63 commit 958b6d5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

action.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,22 @@ inputs:
4747
runs:
4848
using: composite
4949
steps:
50+
# Both pnpm and setup-node expect paths relative to checked-out repo. But we
51+
# want to use package.json and .nvmrc from action repo. So, we'll provide
52+
# them a path relative to GITHUB_WORKSPACE
53+
# See https://github.com/actions/setup-node/issues/852
54+
- id: action_relative_path
55+
run: |
56+
action_path=$(node -p 'require("path").relative(process.env.GITHUB_WORKSPACE, "${{ github.action_path }}")')
57+
echo "action_path=${action_path}" >> "$GITHUB_OUTPUT"
58+
shell: bash
59+
5060
- uses: pnpm/action-setup@v2
5161
with:
52-
version: 7
62+
package_json_file: ${{ steps.action_relative_path.outputs.action_path }}/package.json
5363
- uses: actions/setup-node@v3
5464
with:
55-
node-version-file: ".nvmrc"
65+
node-version-file: ${{ steps.action_relative_path.outputs.action_path }}/.nvmrc
5666
- name: Set up action
5767
run: |
5868
echo "::group::Set up action"

0 commit comments

Comments
 (0)