diff --git a/dist/index.js b/dist/index.js index 984063a1..99be9658 100644 --- a/dist/index.js +++ b/dist/index.js @@ -9100,8 +9100,20 @@ exports.withCustomRequest = withCustomRequest; const { exec } = __webpack_require__(986); const npmArgs = __webpack_require__(510); -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"); + } }; diff --git a/lib/auditFix.js b/lib/auditFix.js index cd9d22a7..fecc105e 100644 --- a/lib/auditFix.js +++ b/lib/auditFix.js @@ -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"); + } };