Skip to content

Commit b036c0d

Browse files
authored
Swallow error on ENOENT
1 parent 327b709 commit b036c0d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/install-pnpm/run.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ async function readTarget(opts: {
4646
let packageManager
4747

4848
if (GITHUB_WORKSPACE) {
49-
({ packageManager } = JSON.parse(await readFile(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8')))
49+
try {
50+
({ packageManager } = JSON.parse(await readFile(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8')))
51+
} catch (error) {
52+
// Swallow error if package.json doesn't exist in root
53+
if (error.code !== 'ENOENT') throw error
54+
}
5055
}
5156

5257
if (version) {

0 commit comments

Comments
 (0)