8 Commits

Author SHA1 Message Date
4b568c8023 docs: remove v2 warning
@zkochan If you have tested that it work with newer Node.js versions, this warning can be removed.
2024-07-05 21:52:13 +07:00
18ac635edf docs: remove redundant manual cache due to setup-node cache (#131) 2024-07-05 15:24:26 +02:00
0d0b43217a docs: add warning about v2 2024-07-05 14:37:28 +02:00
0eb0e97082 Add readme example for omitting version (#134)
* Add readme example for omitting `version`

* docs: more detailed explanations

---------

Co-authored-by: Khải <hvksmr1996@gmail.com>
2024-07-04 10:37:24 +02:00
23657c8550 docs: change order of setup node and pnpm (#129) 2024-06-16 14:33:23 +02:00
5d79380f29 fix: add missing outputs metadata to action.yml (#127) 2024-06-12 16:45:37 +02:00
562dbbf611 fix: correct typo in error message (#125) 2024-06-12 16:44:03 +02:00
00884bcdc5 docs: use cached pnpm installation (#128) 2024-06-12 16:38:46 +02:00
3 changed files with 30 additions and 18 deletions

View File

@ -60,7 +60,9 @@ Location of `pnpm` and `pnpx` command.
## Usage example ## Usage example
### Just install pnpm ### Install only pnpm without `packageManager`
This works when the repo either doesn't have a `package.json` or has a `package.json` but it doesn't specify `packageManager`.
```yaml ```yaml
on: on:
@ -77,6 +79,23 @@ jobs:
version: 8 version: 8
``` ```
### Install only pnpm with `packageManager`
Omit `version` input to use the version in the [`packageManager` field in the `package.json`](https://nodejs.org/api/corepack.html).
```yaml
on:
- push
- pull_request
jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: pnpm/action-setup@v4
```
### Install pnpm and a few npm packages ### Install pnpm and a few npm packages
```yaml ```yaml
@ -115,29 +134,17 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v4
name: Install pnpm name: Install pnpm
with: with:
version: 8 version: 8
run_install: false run_install: false
- name: Get pnpm store directory - name: Install Node.js
shell: bash uses: actions/setup-node@v4
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with: with:
path: ${{ env.STORE_PATH }} node-version: 20
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} cache: 'pnpm'
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies - name: Install dependencies
run: pnpm install run: pnpm install

View File

@ -23,6 +23,11 @@ inputs:
description: When set to true, @pnpm/exe, which is a Node.js bundled package, will be installed, enabling using pnpm without Node.js. description: When set to true, @pnpm/exe, which is a Node.js bundled package, will be installed, enabling using pnpm without Node.js.
required: false required: false
default: 'false' default: 'false'
outputs:
dest:
description: Expanded path of inputs#dest
bin_dest:
description: Location of `pnpm` and `pnpx` command
runs: runs:
using: node20 using: node20
main: dist/index.js main: dist/index.js

View File

@ -72,7 +72,7 @@ Remove one of these versions to avoid version mismatch errors like ERR_PNPM_BAD_
if (!GITHUB_WORKSPACE) { if (!GITHUB_WORKSPACE) {
throw new Error(`No workspace is found. throw new Error(`No workspace is found.
If you're intended to let pnpm/action-setup read preferred pnpm version from the "packageManager" field in the package.json file, If you've intended to let pnpm/action-setup read preferred pnpm version from the "packageManager" field in the package.json file,
please run the actions/checkout before pnpm/action-setup. please run the actions/checkout before pnpm/action-setup.
Otherwise, please specify the pnpm version in the action configuration.`) Otherwise, please specify the pnpm version in the action configuration.`)
} }