Swallow error on ENOENT

This commit is contained in:
Karl Horky 2024-04-19 16:43:36 +02:00 committed by GitHub
parent 327b709af8
commit b036c0dcb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,7 +46,12 @@ async function readTarget(opts: {
let packageManager
if (GITHUB_WORKSPACE) {
({ packageManager } = JSON.parse(await readFile(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8')))
try {
({ packageManager } = JSON.parse(await readFile(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8')))
} catch (error) {
// Swallow error if package.json doesn't exist in root
if (error.code !== 'ENOENT') throw error
}
}
if (version) {