diff --git a/src/save.ts b/src/save.ts index 0ce647f..a34923c 100644 --- a/src/save.ts +++ b/src/save.ts @@ -36,10 +36,12 @@ async function run() { const registryName = await getRegistryName(); const packages = await getPackages(); - try { - await cleanRegistry(registryName, packages); - } catch (e) { - core.info(`[warning] ${(e as any).stack}`); + if (registryName) { + try { + await cleanRegistry(registryName, packages); + } catch (e) { + core.info(`[warning] ${(e as any).stack}`); + } } try { @@ -71,7 +73,7 @@ async function run() { run(); -async function getRegistryName(): Promise { +async function getRegistryName(): Promise { const globber = await glob.create(`${paths.index}/**/.last-updated`, { followSymbolicLinks: false }); const files = await globber.glob(); if (files.length > 1) { @@ -79,6 +81,9 @@ async function getRegistryName(): Promise { } const first = files.shift()!; + if (!first) { + return null; + } return path.basename(path.dirname(first)); }