Skip to content

Commit 4dcd12e

Browse files
committed
chore: update pnpm/action-setup
Add new package_json_path input. Set default pnpm version to 'null'
1 parent 0883aee commit 4dcd12e

File tree

7 files changed

+79
-24
lines changed

7 files changed

+79
-24
lines changed

.github/renovate.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,5 @@
2626
"groupName": "major-update"
2727
}
2828
],
29-
"extends": [
30-
"config:recommended",
31-
":pinVersions",
32-
"npm:unpublishSafe",
33-
":prNotPending",
34-
":preserveSemverRanges",
35-
":rebaseStalePrs"
36-
]
29+
"extends": ["config:recommended", ":pinVersions", "npm:unpublishSafe", ":prNotPending", ":preserveSemverRanges", ":rebaseStalePrs"]
3730
}

.github/workflows/test.yml

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
cwd: 'test'
2020
install-ignore-scripts: true
2121

22-
- name: Check version
22+
- name: Check node version
2323
id: check-version
2424
run: |
2525
NODE_VERSION=$(node -v)
@@ -47,17 +47,18 @@ jobs:
4747
if: ${{ steps.check-pnpm-version.outputs.PNPM_VERSION_FIRST_PART != steps.check-pnpm-version.outputs.MATRIX_PNPM_VERSION_FIRST_PART }}
4848
run: exit 1
4949

50-
test-version-file:
50+
test-node-version-file:
5151
runs-on: ubuntu-latest
5252
steps:
5353
- uses: actions/checkout@v4
5454
- uses: ./
5555
with:
56+
pnpm: 9
5657
cwd: 'test'
5758
node-file: '.node-version'
5859
install-ignore-scripts: true
5960

60-
- name: check version
61+
- name: check node version
6162
id: check-node-version
6263
run: echo "VERSION=$(node -v)" >> $GITHUB_OUTPUT
6364

@@ -75,3 +76,35 @@ jobs:
7576
- name: Fail on wrong pnpm version (${{ steps.check-pnpm-version.outputs.PNPM_VERSION_FIRST_PART }})
7677
if: ${{ steps.check-pnpm-version.outputs.PNPM_VERSION_FIRST_PART != '9' }}
7778
run: exit 1
79+
80+
test-package-version-manager:
81+
runs-on: ubuntu-latest
82+
steps:
83+
- uses: actions/checkout@v4
84+
- uses: ./
85+
with:
86+
node: 22
87+
cwd: 'test/test-package-version-manager'
88+
install-ignore-scripts: true
89+
90+
- name: check node version
91+
id: check-node-version
92+
run: |
93+
NODE_VERSION=$(node -v)
94+
NODE_VERSION_FIRST_PART=$(echo $NODE_VERSION | cut -d. -f1)
95+
echo "NODE_VERSION_FIRST_PART=$NODE_VERSION_FIRST_PART" >> $GITHUB_OUTPUT
96+
97+
- name: fail on wrong version (${{ steps.check-node-version.outputs.NODE_VERSION_FIRST_PART }})
98+
if: ${{ steps.check-node-version.outputs.NODE_VERSION_FIRST_PART != 'v22' }}
99+
run: exit 1
100+
101+
- name: Check pnpm version
102+
id: check-pnpm-version
103+
run: |
104+
PNPM_VERSION=$(pnpm -v)
105+
PNPM_VERSION_FIRST_PART=$(echo $PNPM_VERSION | cut -d. -f1)
106+
echo "PNPM_VERSION_FIRST_PART=$PNPM_VERSION_FIRST_PART" >> $GITHUB_OUTPUT
107+
108+
- name: Fail on wrong pnpm version (${{ steps.check-pnpm-version.outputs.PNPM_VERSION_FIRST_PART }})
109+
if: ${{ steps.check-pnpm-version.outputs.PNPM_VERSION_FIRST_PART != '9' }}
110+
run: exit 1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
test/node_modules
2+
test/test-package-version-manager/node_modules
23
/.idea/

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout your repository using git
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414

1515
- name: setup node and pnpm
16-
uses: dafnik/setup-node-pnpm@v3
16+
uses: dafnik/setup-node-pnpm@v4
1717
# with:
18-
# pnpm: 8
1918
# node: 22
2019
# node-file: ''
2120
# cwd: '.'
@@ -24,14 +23,15 @@ jobs:
2423
```
2524

2625
<!-- prettier-ignore-start -->
27-
| Inputs | Default value | Description |
28-
|--------------------------|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
29-
| `pnpm` | `9` | PNPM version to install |
30-
| `node` | `22` | Version Spec of the version to use in SemVer notation.<br /> It also emits such aliases as lts, latest, nightly and canary builds.<br /> Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node |
31-
| `node-file` | `''` | File containing the version Spec of the version to use.<br /> Examples: .nvmrc, .node-version, .tool-versions.<br /> If `node` and `node-file` are both provided the action will use version from `node-file`. |
32-
| `cwd` | `.` | Changes pnpm-lock.yaml lookup location and the work directory of "pnpm install" if enabled |
33-
| `install` | `false` | Runs "pnpm install" in working directory |
34-
| `install-ignore-scripts` | `false` | Runs "pnpm install --ignore-scripts" in working directory. Enable "install" or "install-ignore-scripts" only once |
26+
| Inputs | Default value | Description |
27+
|--------------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
28+
| `pnpm` | | PNPM version to install |
29+
| `node` | `22` | Version Spec of the version to use in SemVer notation.<br /> It also emits such aliases as lts, latest, nightly and canary builds.<br /> Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node |
30+
| `node-file` | `''` | File containing the version Spec of the version to use.<br /> Examples: .nvmrc, .node-version, .tool-versions.<br /> If `node` and `node-file` are both provided the action will use the version from `node-file`. |
31+
| `cwd` | `.` | Changes pnpm-lock.yaml lookup location and the work directory of "pnpm install" if enabled |
32+
| `package_file` | `package.json` | File path to the package.json to read "packageManager" configuration (also supports package.yml). Works in conjunction with "cwd" input. |
33+
| `install` | `false` | Runs "pnpm install" in working directory |
34+
| `install-ignore-scripts` | `false` | Runs "pnpm install --ignore-scripts" in working directory. Enable "install" or "install-ignore-scripts" only once |
3535
<!-- prettier-ignore-end -->
3636

3737
Furthermore, see [action.yml](action.yml)

action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,22 @@ inputs:
99
pnpm:
1010
description: 'PNPM version'
1111
required: false
12-
default: '9'
1312
node:
1413
description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.'
1514
required: false
1615
default: '22'
1716
node-file:
18-
description: 'File containing the version Spec of the version to use. Examples: .nvmrc, .node-version, .tool-versions.'
17+
description: 'File containing the version Spec of the version to use. Examples: .nvmrc, .node-version, .tool-versions. If "node" and "node-file" are both provided the action will use the version from "node-file".'
1918
required: false
2019
default: ''
2120
cwd:
2221
description: 'Work directory'
2322
required: false
2423
default: '.'
24+
package_file:
25+
description: 'File path to the package.json to read "packageManager" configuration (also supports package.yml). Works in conjunction with "cwd"'
26+
required: false
27+
default: 'package.json'
2528
install:
2629
description: 'Runs pnpm install'
2730
required: false
@@ -38,6 +41,7 @@ runs:
3841
uses: pnpm/action-setup@v4
3942
with:
4043
version: ${{ inputs.pnpm }}
44+
package_json_file: '${{ inputs.cwd }}/${{ inputs.package_file }}'
4145

4246
- name: use Node.js ${{ inputs.node }}
4347
if: "${{ inputs.node-file == '' }}"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "test-package-version-manager",
3+
"version": "1.0.0",
4+
"packageManager": "pnpm@9.11.0",
5+
"description": "",
6+
"main": "index.js",
7+
"keywords": [],
8+
"author": "",
9+
"license": "ISC",
10+
"devDependencies": {
11+
"@types/node": "latest"
12+
}
13+
}

test/test-package-version-manager/pnpm-lock.yaml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)