Commit Graph
31 Commits
Author SHA1 Message Date
Zoltan Kochan aec59b9f6c fix: fall back to pnpm shim in same directory for self-update bin/
ensureAliasLinks had a hardcoded relative path to @pnpm/exe/pnpm which
only works from node_modules/.bin/. In self-update's bin/ directory
($PNPM_HOME/bin/), that path doesn't resolve. Now falls back to using
the pnpm shim in the same directory when the package path doesn't exist.
2026-03-26 20:24:03 +01:00
Zoltan Kochan 76bfe9d01c fix: also create alias links in $PNPM_HOME/bin/
self-update links bins to $PNPM_HOME/bin/ which comes first in PATH.
Without alias links there, the broken pnx shim from self-update
(pointing to placeholder files) takes precedence over our .bin/pnx.
2026-03-26 19:14:42 +01:00
Zoltan Kochan 188c8307ce fix: point pn to pnpm binary directly, not to @pnpm/exe/pn
pnpm self-update only replaces the pnpm binary — it does not update
other files in the @pnpm/exe package (setup.js, pn, pnpx, pnx all
remain from the v10 bootstrap). So @pnpm/exe/pn may not exist at all.

Instead of relying on @pnpm/exe/pn, create the aliases directly:
- pn → symlink to the pnpm binary
- pnpx/pnx → shell scripts that exec "pnpm dlx"

Also remove the setup.js call after self-update since it's no longer
needed and would run the v10 version which doesn't know about pn.
2026-03-26 18:58:55 +01:00
Zoltan Kochan b179ac1ba6 fix: force-replace npm's broken bin shims for pn/pnx aliases
npm creates bin shims in .bin/ that point to an isolated copy in
.bin/.tools/. After self-update, setup.js fixes the main copy in
node_modules/@pnpm/exe/ but the .tools copy retains stale placeholder
files. Always replace the bin links so they point directly to the
fixed files instead of npm's broken .tools shims.
2026-03-26 18:54:54 +01:00
Zoltan Kochan 51e56d41e9 fix: run setup.js after self-update to create pn/pnx hardlinks
self-update replaces the @pnpm/exe package files but does not re-run
preinstall scripts. This leaves pn/pnpx/pnx as placeholder files
("This file intentionally left blank") instead of hardlinks to the
actual binary. Run setup.js explicitly after self-update to fix this.
2026-03-26 18:49:59 +01:00
Zoltan Kochan 11687bb3d2 fix: handle Windows with .cmd/.ps1 shims and add tests
- Extract ensureAliasLinks to its own module for testability
- On Windows, create .cmd and .ps1 shims instead of symlinks
- On Unix, create symlinks (as before)
- Skip alias creation when targets don't exist (pnpm v10)
- Add vitest and 8 tests covering unix/windows/skip/no-overwrite
2026-03-26 18:41:05 +01:00
Zoltan Kochan 747414e7da feat: create pn and pnx alias symlinks for pnpm v11+
After self-update, create symlinks for pn, pnpx, and pnx in
node_modules/.bin if the target files exist in the installed package.
This enables the short aliases introduced in pnpm v11.
2026-03-26 18:34:35 +01:00
Zoltan KochanandGitHub 62bce64275 fix: extract pnpm version from packageManager field instead of returning undefined (#216)
When packageManager is set to e.g. "pnpm@9.1.0+sha...", strip the
"pnpm@" prefix and any "+sha..." hash suffix so the action installs
the correct version. Previously returning undefined caused failures
on Windows.
2026-03-25 13:59:54 +01:00
58e6119fe4 feat!: replace bundled pnpm binary with npm + lockfile bootstrap (#212)
* feat!: replace bundled pnpm binary with npm + lockfile bootstrap

Remove the 9MB bundled pnpm.cjs/worker.js and instead use npm ci with
committed package-lock.json files (~5KB) to install a bootstrap pnpm,
which then installs the target version with integrity verification via
the project's pnpm-lock.yaml.

Also switch from ncc to esbuild and modernize to ESM.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: bundle as CJS to support @actions/* packages

The @actions/* packages use CJS require() for Node.js builtins,
which fails with "Dynamic require of 'os' is not supported" when
bundled as ESM. Switch esbuild output to CJS format.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: remove "type": "module" from package.json

Node.js treats dist/index.js as ESM due to "type": "module",
but the bundle uses CJS require() calls. Remove the field so
Node.js defaults to CJS for .js files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: remove packageManager field and fix Windows npm spawn

- Remove packageManager from package.json to avoid version conflict
  when the action tests against itself (uses: ./)
- Use shell: true on Windows so spawn can find npm.cmd

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: always use pnpm (not @pnpm/exe) for bootstrap and update lockfile

The bootstrap only needs regular pnpm to install the target package.
@pnpm/exe requires install scripts which we skip with --ignore-scripts.
Also regenerate pnpm-lock.yaml to match current package.json.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use --no-lockfile for target install

--lockfile-dir pointing to GITHUB_WORKSPACE causes the bootstrap pnpm
to use the project's pnpm-lock.yaml (which tracks project deps, not
pnpm itself), corrupting the install. Revert to --no-lockfile for now.
Lockfile-based integrity verification can be added when pnpm v11 has
proper support for verifying the pnpm package itself.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: run bootstrap pnpm via node instead of bin shim

Use `node .../pnpm/bin/pnpm.cjs` to run the bootstrap pnpm, matching
the approach used by the old bundled pnpm.cjs. This avoids issues with
the .bin symlink on different platforms.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: use pnpm self-update instead of installing target separately

- Bootstrap pnpm via npm ci (verified by lockfile)
- Use `pnpm self-update <version>` for explicit version
- Let pnpm handle packageManager field automatically
- Remove standalone/exe-specific install logic (pnpm handles this)
- Update tests to not run pnpm install against the action repo itself

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: support standalone mode with @pnpm/exe bootstrap

- When standalone=true, bootstrap with @pnpm/exe via npm ci
- When standalone=false, bootstrap with pnpm via npm ci
- Both use pnpm self-update to reach the target version
- Remove --ignore-scripts from npm ci so @pnpm/exe install scripts run
- Add standalone test back to CI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* debug: add logging to diagnose pnpm not found on PATH

Log .bin directory contents after npm ci to understand why
pnpm binary is not found in subsequent CI steps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: ensure pnpm bin link exists after npm ci

npm ci sometimes doesn't create the .bin/pnpm symlink for
@pnpm/exe (observed on Linux CI). Manually create the symlink
if it's missing after npm ci completes.

This fixes the case where standalone=true with no explicit version
(relying on packageManager field) — pnpm self-update wouldn't run,
leaving .bin empty and pnpm not found on PATH.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add PNPM_HOME/bin to PATH for pnpm v11

pnpm v11 moved global binaries from PNPM_HOME to PNPM_HOME/bin.
Add the new bin subdirectory to PATH so that pnpm's global bin
directory check passes. This is backwards compatible — the extra
PATH entry is harmless for older pnpm versions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: add packages field to pnpm-workspace.yaml

pnpm v9 requires the packages field in pnpm-workspace.yaml.
Without it, `pnpm --version` fails with "packages field missing or empty".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix pnpm-workspace.yaml

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 14:02:31 +01:00
Zoltan Kochan fc06bc1257 feat!: run the action on Node.js 24 (#205) 2026-03-13 11:30:26 +01:00
Zoltan Kochan b906affcce Revert "feat!: run the action on Node.js 24 (#205)"
This reverts commit 9b5745cdf0.
2026-03-11 15:54:42 +01:00
Zoltan KochanandGitHub 9b5745cdf0 feat!: run the action on Node.js 24 (#205) 2026-02-17 13:30:54 +01:00
Zoltan Kochan a7487c7e89 feat: update dist 2025-02-06 22:30:07 +01:00
Zoltan Kochan fff70888d0 test: update pnpm to v9 2025-02-06 22:24:21 +01:00
Zoltan KochanandGitHub 0d0b43217a docs: add warning about v2 2024-07-05 14:37:28 +02:00
Zoltan Kochan fe02b34f77 docs: bump action-setup version in README 2024-05-07 15:16:48 +02:00
Zoltan KochanandGitHub 2ab6dce4f5 docs(README): fix link to LICENSE 2024-03-27 22:17:57 +01:00
Zoltan Kochan a3252b78c4 docs(README): update version 2024-02-08 11:28:50 +01:00
Zoltan Kochan c3b53f6a16 chore(release): 2.2.4 2022-10-15 21:12:50 +03:00
Zoltan Kochan 21e88da200 fix(deps): update 2022-10-15 21:12:13 +03:00
Zoltan Kochan fc3334fa11 build 2022-10-15 21:09:00 +03:00
Zoltan KochanandGitHub 10693b3829 Update action.yml 2022-05-28 17:23:43 +03:00
Zoltan Kochan 99ecd24520 v2.2.2 2022-05-28 17:22:28 +03:00
Zoltan KochanandGitHub 958500fcab fix: do not download pnpm from get.pnpm.io (#46)
* fix: do not download pnpm from get.pnpm.io

* fix: remove redundant files
2022-05-28 16:54:43 +03:00
Zoltan Kochan 225f3bb4b0 build 2022-02-22 11:34:20 +02:00
Zoltan KochanandGitHub 777a50d72e Update src/install-pnpm/run.ts 2022-02-22 11:32:59 +02:00
Zoltan Kochan d8ea532ac4 fix: retry fetch of pnpm script
close #22
2022-02-20 21:49:26 +02:00
Zoltan Kochan 9eb14dd77c decrease bundle size 2022-02-08 14:44:50 +02:00
Zoltan Kochan eafb777c56 download script from pnpm.io 2022-02-08 00:39:20 +02:00
Zoltan Kochan e6378df420 PNPM_HOME_PATH=>PNPM_HOME 2022-02-08 00:21:53 +02:00
Zoltan Kochan 6ff6e97bc6 The pnpm home directory should be added to PATH and PNPM_HOME
This change is needed to make the action compatible with pnpm v7.

Related breaking change in pnpm: pnpm/pnpm#4280
2022-02-07 23:15:44 +02:00