Skip to content

Commit

Permalink
feat: improve pull request body (#130)
Browse files Browse the repository at this point in the history
- Improve the footer format.
- Add the used npm version.
  • Loading branch information
ybiquitous committed Jun 10, 2020
1 parent 9cc98f9 commit c7db305
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 14 deletions.
25 changes: 18 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,16 @@ module.exports._parse = parse;
module.exports._enoent = enoent;


/***/ }),

/***/ 32:
/***/ (function(module) {

module.exports.PACKAGE_NAME = "npm-audit-fix-action";
module.exports.PACKAGE_URL = "https://github.com/ybiquitous/npm-audit-fix-action";
module.exports.NPM_VERSION = "6.14.5";


/***/ }),

/***/ 39:
Expand Down Expand Up @@ -1915,8 +1925,7 @@ function parseGitUrl (giturl) {

const { exec } = __webpack_require__(986);
const npmArgs = __webpack_require__(510);

const NPM_VERSION = "6.14.5";
const { NPM_VERSION } = __webpack_require__(32);

module.exports = async function updateNpm() {
await exec("sudo", ["npm", ...npmArgs("install", "--global", `npm@${NPM_VERSION}`)]);
Expand Down Expand Up @@ -6959,13 +6968,11 @@ module.exports = resolveCommand;
/***/ 510:
/***/ (function(module) {

const DEFAULT_OPTIONS = Object.freeze(["--ignore-scripts", "--no-progress"]);

/**
* @param {string[]} args
*/
module.exports = function npmArgs(...args) {
return [...args, ...DEFAULT_OPTIONS];
return [...args, "--ignore-scripts", "--no-progress"];
};


Expand Down Expand Up @@ -8190,7 +8197,9 @@ module.exports = async function aggregateReport(audit, fix) {
/***/ }),

/***/ 603:
/***/ (function(module) {
/***/ (function(module, __unusedexports, __webpack_require__) {

const { PACKAGE_NAME, PACKAGE_URL, NPM_VERSION } = __webpack_require__(32);

/**
* @param {Report} report
Expand Down Expand Up @@ -8266,9 +8275,11 @@ module.exports = function buildPullRequestBody(report) {
});
}

lines.push("");
lines.push("***");
lines.push("");
lines.push(
"*This pull request is created by [npm-audit-fix-action](https://github.com/ybiquitous/npm-audit-fix-action).*"
`This pull request is created by [${PACKAGE_NAME}](${PACKAGE_URL}). The used npm version is **${NPM_VERSION}**.`
);

return lines.join("\n").trim();
Expand Down
4 changes: 3 additions & 1 deletion lib/__tests__/buildPullRequestBody.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ test("buildPullRequestBody()", () => {
|:--------|:-------:|:-------|
| [@gitlab/ui](https://npm.im/@gitlab/ui) ([gitlab](https://gitlab.com/gitlab-org/gitlab-ui)) | \`1.2.3\` | - |
*This pull request is created by [npm-audit-fix-action](https://github.com/ybiquitous/npm-audit-fix-action).*
***
This pull request is created by [npm-audit-fix-action](https://github.com/ybiquitous/npm-audit-fix-action). The used npm version is **6.14.5**.
`.trim()
);
});
6 changes: 5 additions & 1 deletion lib/buildPullRequestBody.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { PACKAGE_NAME, PACKAGE_URL, NPM_VERSION } = require("./constants");

/**
* @param {Report} report
* @returns {String}
Expand Down Expand Up @@ -72,9 +74,11 @@ module.exports = function buildPullRequestBody(report) {
});
}

lines.push("");
lines.push("***");
lines.push("");
lines.push(
"*This pull request is created by [npm-audit-fix-action](https://github.com/ybiquitous/npm-audit-fix-action).*"
`This pull request is created by [${PACKAGE_NAME}](${PACKAGE_URL}). The used npm version is **${NPM_VERSION}**.`
);

return lines.join("\n").trim();
Expand Down
3 changes: 3 additions & 0 deletions lib/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports.PACKAGE_NAME = "npm-audit-fix-action";
module.exports.PACKAGE_URL = "https://github.com/ybiquitous/npm-audit-fix-action";
module.exports.NPM_VERSION = "6.14.5";
4 changes: 1 addition & 3 deletions lib/npmArgs.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const DEFAULT_OPTIONS = Object.freeze(["--ignore-scripts", "--no-progress"]);

/**
* @param {string[]} args
*/
module.exports = function npmArgs(...args) {
return [...args, ...DEFAULT_OPTIONS];
return [...args, "--ignore-scripts", "--no-progress"];
};
3 changes: 1 addition & 2 deletions lib/updateNpm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { exec } = require("@actions/exec");
const npmArgs = require("./npmArgs");

const NPM_VERSION = "6.14.5";
const { NPM_VERSION } = require("./constants");

module.exports = async function updateNpm() {
await exec("sudo", ["npm", ...npmArgs("install", "--global", `npm@${NPM_VERSION}`)]);
Expand Down

0 comments on commit c7db305

Please sign in to comment.