8000 env.VERSION Not Initialized When Using pnpm in GitHub Actions · Issue #69 · withastro/action · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

env.VERSION Not Initialized When Using pnpm in GitHub Actions #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
matteo-cavallo opened this issue Feb 21, 2025 · 2 comments
Open

Comments

@matteo-cavallo
Copy link

When using pnpm as the package manager in a GitHub Action workflow, the environment variable env.VERSION is not properly initialized. This results in the following step failing:

- name: Setup PNPM
  if: ${{ env.PACKAGE_MANAGER == 'pnpm' }}
  uses: pnpm/action-setup@v4
  with:
    version: ${{ env.VERSION }}
    package_json_file: "${{ inputs.path }}/package.json"

Since env.VERSION is not set, the pnpm/action-setup step does not function correctly.

Potential Cause

The issue appears to stem from the package manager detection logic:

elif [ $(find "." -maxdepth 1 -name "pnpm-lock.yaml") ]; then
    echo "PACKAGE_MANAGER=pnpm" >> $GITHUB_ENV
    echo "LOCKFILE=pnpm-lock.yaml" >> $GITHUB_ENV

While PACKAGE_MANAGER and LOCKFILE are being assigned, VERSION is not explicitly set, causing workflows that rely on it to break.

@mikerice
Copy link

Also seeing this! Will try to submit a PR if I get a chance

@mikerice
Copy link
mikerice commented Feb 27, 2025

To follow up: the proper fix is just to ensure that packageManager is defined in your package.json. Otherwise, I don't think there is any reason to either:

  1. explicitly define VERSION=latest, which can cause issues for projects that have a defined pnpm version in their package.json
  2. perform some magic to use the lockfileVersion in pnpm-lock.yaml as this is backwards compatible and not necessarily a source of truth of the pnpm version being used.

alipex added a commit to alipex/test-web that referenced this issue Mar 17, 2025
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

No branches or pull requests

2 participants
0