Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ export const validatePackage = async (packageName: string, pluginVersion: string
core.info(`Found package ${packageAndVersion} in the npm registry`)
return true
} catch (error) {
const { statusCode } = error as Error & { statusCode: number }
if (statusCode) {
core.warning(`${packageAndVersion} does no exist in npm registry`)
const { statusCode, code } = error as Error & { statusCode?: number; code?: string }
// If the package is new and not yet published then there will be a 404.
// If the package exists but the version hasn't been published yet then there will be an ETARGET error.
if (statusCode || code === 'ETARGET') {
core.warning(`${packageAndVersion} does not exist in npm registry yet. Checking again shortly...`)
return false
}
throw error
Expand Down