Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ignore return code of npm audit fix #410

Merged
merged 3 commits into from
May 18, 2021
Merged
Show file tree
Hide file tree
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
16 changes: 14 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
};


Expand Down
16 changes: 14 additions & 2 deletions lib/auditFix.js
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");
}
};