From 958b6d59f51720a7b0f2d402f87ba193e39bc080 Mon Sep 17 00:00:00 2001 From: Sid Vishnoi <8426945+sidvishnoi@users.noreply.github.com> Date: Tue, 12 Sep 2023 16:53:01 +0530 Subject: [PATCH] fix(action.yml): use `.nvmrc`, `package.json` from action repo (#165) --- action.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 8152233..8ced16d 100644 --- a/action.yml +++ b/action.yml @@ -47,12 +47,22 @@ inputs: runs: using: composite steps: + # Both pnpm and setup-node expect paths relative to checked-out repo. But we + # want to use package.json and .nvmrc from action repo. So, we'll provide + # them a path relative to GITHUB_WORKSPACE + # See https://github.com/actions/setup-node/issues/852 + - id: action_relative_path + run: | + action_path=$(node -p 'require("path").relative(process.env.GITHUB_WORKSPACE, "${{ github.action_path }}")') + echo "action_path=${action_path}" >> "$GITHUB_OUTPUT" + shell: bash + - uses: pnpm/action-setup@v2 with: - version: 7 + package_json_file: ${{ steps.action_relative_path.outputs.action_path }}/package.json - uses: actions/setup-node@v3 with: - node-version-file: ".nvmrc" + node-version-file: ${{ steps.action_relative_path.outputs.action_path }}/.nvmrc - name: Set up action run: | echo "::group::Set up action"