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>
This commit is contained in:
Karl Horky 2024-07-04 10:37:24 +02:00 committed by GitHub
parent 23657c8550
commit 0eb0e97082
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,7 +60,9 @@ Location of `pnpm` and `pnpx` command.
## 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
on:
@ -77,6 +79,23 @@ jobs:
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
```yaml