Skip to content

Commit

Permalink
Don't set action as failed when file was already deleted (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
robbevp authored Mar 31, 2024
1 parent 645d0b0 commit 9665c2a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ async function main() {
const netrc = path.resolve(os.homedir(), ".netrc");
await fs.unlink(netrc);
} catch (err) {
if (isErrnoException(err) && err.code == "ENOENT") return;
if (err instanceof Error) {
core.setFailed(err.message);
}
}
}

function isErrnoException(e: unknown): e is NodeJS.ErrnoException {
if ("code" in (e as any)) return true;
else return false;
}

main();

0 comments on commit 9665c2a

Please sign in to comment.