generated from actions/javascript-action
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ignore return code of
npm audit fix
(#410)
- Loading branch information
1 parent
b9a4260
commit 38f4153
Showing
2 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
const { exec } = require("@actions/exec"); | ||
const npmArgs = require("./npmArgs"); | ||
|
||
module.exports = function auditFix() { | ||
return exec("npm", npmArgs("audit", "fix")); | ||
module.exports = async function auditFix() { | ||
let error = ""; | ||
await exec("npm", npmArgs("audit", "fix"), { | ||
listeners: { | ||
stderr: (data) => { | ||
error += data.toString(); | ||
}, | ||
}, | ||
ignoreReturnCode: true, | ||
}); | ||
|
||
if (error.includes("npm ERR!")) { | ||
throw new Error("Unexpected error occurred"); | ||
} | ||
}; |