Skip to content

Commit 790dcb7

Browse files
committed
ci: drop root packageManager field to unblock yarn link in tests
Yarn 1.22.22 (the system yarn on GitHub runners) refuses to run when it finds a `packageManager` value that doesn't start with `yarn@`. The CLI init tests and the basic-event-handlers example both shell out to yarn (`yarn link @graphprotocol/graph-cli`, `yarn codegen`) from directories nested inside the repo, so yarn walks up to the root and bails on `pnpm@10.17.1`. Drop the field; tighten `engines.pnpm` to `^10`; pin the pnpm version in CI by passing `packageManagerVersion: '10.17.1'` to the setup-node composite action. While there, fix the shell in the action so the input is actually honored (the previous `if [ ! -z {{inputs.packageManager}} ]` was a literal-string test and never reflected the input value).
1 parent 74aebdb commit 790dcb7

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

.github/actions/setup-node/action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ runs:
3030
if: inputs.packageManager == 'pnpm'
3131
working-directory: ${{ inputs.workingDirectory }}
3232
run: |
33-
PNPM_VERSION=${PNPM_VERSION:-9.0.6}
34-
PKG_JSON=$(cat package.json | jq -r '.packageManager' | awk -F@ '{print $2}')
35-
if [ ! -z $PKG_JSON ]; then
36-
PNPM_VERSION=$PKG_JSON
37-
fi
38-
if [ ! -z {{inputs.packageManager}} ]; then
39-
PNPM_VERSION=${{ inputs.packageManagerVersion }}
33+
PNPM_VERSION='${{ inputs.packageManagerVersion }}'
34+
if [ -z "$PNPM_VERSION" ]; then
35+
PKG_JSON=$(jq -r '.packageManager // ""' package.json | awk -F@ '{print $2}')
36+
if [ -n "$PKG_JSON" ]; then
37+
PNPM_VERSION="$PKG_JSON"
38+
fi
4039
fi
40+
PNPM_VERSION="${PNPM_VERSION:-10.17.1}"
4141
echo "Using PNPM version $PNPM_VERSION"
4242
echo "version=$PNPM_VERSION" >> $GITHUB_OUTPUT
4343

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
with:
2727
nodeVersion: 22
2828
packageManager: pnpm
29+
packageManagerVersion: '10.17.1'
2930

3031
- name: Lint
3132
run: pnpm lint
@@ -49,6 +50,7 @@ jobs:
4950
with:
5051
nodeVersion: ${{ matrix.node-version }}
5152
packageManager: pnpm
53+
packageManagerVersion: '10.17.1'
5254

5355
- name: Setup git user information
5456
run: |
@@ -80,6 +82,7 @@ jobs:
8082
with:
8183
nodeVersion: 22
8284
packageManager: pnpm
85+
packageManagerVersion: '10.17.1'
8386

8487
- name: Build Packages
8588
run: pnpm build
@@ -109,6 +112,7 @@ jobs:
109112
with:
110113
nodeVersion: 22
111114
packageManager: pnpm
115+
packageManagerVersion: '10.17.1'
112116

113117
- name: Build Packages
114118
run: pnpm build # will also check types

.github/workflows/publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
with:
3737
nodeVersion: 24
3838
packageManager: pnpm
39+
packageManagerVersion: '10.17.1'
3940

4041
- name: Build
4142
if: ${{ startsWith(github.event.head_commit.message, env.RELEASE_COMMIT_MSG) }}
@@ -94,6 +95,7 @@ jobs:
9495
with:
9596
nodeVersion: 24
9697
packageManager: pnpm
98+
packageManagerVersion: '10.17.1'
9799

98100
- name: Determine snapshot tag
99101
id: tag

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
},
1212
"license": "(Apache-2.0 OR MIT)",
1313
"private": true,
14-
"packageManager": "pnpm@10.17.1",
1514
"engines": {
1615
"node": ">=22.0.0",
17-
"pnpm": ">=10"
16+
"pnpm": "^10"
1817
},
1918
"scripts": {
2019
"build": "pnpm --filter=@graphprotocol/graph-* build",

0 commit comments

Comments
 (0)