@@ -110,25 +110,36 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {
110110 logger ( `Running initial build for ${ dir } ` )
111111 if ( ! actionInfo . skipClone ) {
112112 const usePnpm = existsSync ( path . join ( dir , 'pnpm-lock.yaml' ) )
113+ if ( usePnpm ) {
114+ // TODO: we can remove this explicit `corepack use` once Next.js
115+ // 16.3 is released, but we must override it for now because 16.2 uses
116+ // pnpm 9.6.0, which supports different arguments. `diffRepoDir`
117+ // points to the most recent stable tag.
118+ await exec . spawnPromise ( 'corepack use pnpm@10.33.0' , {
119+ cwd : dir ,
120+ } )
121+ }
113122
114123 if ( ! statsConfig . skipInitialInstall ) {
115- await exec . spawnPromise (
116- `cd ${ dir } ${
117- usePnpm
118- ? // --no-frozen-lockfile is used here to tolerate lockfile
119- // changes from merging latest changes
120- // --package-import-method=copy avoids hardlink issues on
121- // self-hosted runners, and the store is colocated with the
122- // workdir to avoid EXDEV copy failures on overlayfs runners.
123- ` && pnpm install --no-frozen-lockfile --package-import-method=copy --store-dir=${ pnpmStoreDir } `
124- : ' && yarn install --network-timeout 1000000'
125- } `,
126- { env : { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD : '1' } }
127- )
124+ const command = usePnpm
125+ ? 'pnpm install ' +
126+ // tolerate lockfile changes from merging latest changes
127+ '--no-frozen-lockfile ' +
128+ // avoid hardlink issues on self-hosted runners,
129+ '--package-import-method=clone-or-copy ' +
130+ // the store is colocated with the workdir to avoid EXDEV copy
131+ // failures on overlayfs runners.
132+ `--store-dir=${ pnpmStoreDir } `
133+ : 'yarn install --network-timeout=1000000'
134+ await exec . spawnPromise ( command , {
135+ env : { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD : '1' } ,
136+ cwd : dir ,
137+ } )
128138
129139 await exec . spawnPromise (
130140 statsConfig . initialBuildCommand ||
131- `cd ${ dir } && ${ usePnpm ? 'pnpm build' : 'echo built' } `
141+ ( usePnpm ? 'pnpm build' : 'echo built' ) ,
142+ { cwd : dir }
132143 )
133144 }
134145 }
0 commit comments