build: updates

This commit is contained in:
marocchino 2021-08-14 09:48:53 +09:00
parent 1f3d2a6328
commit 87e4874fd5
No known key found for this signature in database
GPG key ID: AFF521DBDB122570
5 changed files with 298 additions and 296 deletions

30
dist/index.js generated vendored
View file

@ -6238,7 +6238,7 @@ module.exports = eval("require")("encoding");
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("assert");; module.exports = require("assert");
/***/ }), /***/ }),
@ -6246,7 +6246,7 @@ module.exports = require("assert");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("events");; module.exports = require("events");
/***/ }), /***/ }),
@ -6254,7 +6254,7 @@ module.exports = require("events");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("fs");; module.exports = require("fs");
/***/ }), /***/ }),
@ -6262,7 +6262,7 @@ module.exports = require("fs");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("http");; module.exports = require("http");
/***/ }), /***/ }),
@ -6270,7 +6270,7 @@ module.exports = require("http");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("https");; module.exports = require("https");
/***/ }), /***/ }),
@ -6278,7 +6278,7 @@ module.exports = require("https");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("net");; module.exports = require("net");
/***/ }), /***/ }),
@ -6286,7 +6286,7 @@ module.exports = require("net");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("os");; module.exports = require("os");
/***/ }), /***/ }),
@ -6294,7 +6294,7 @@ module.exports = require("os");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("path");; module.exports = require("path");
/***/ }), /***/ }),
@ -6302,7 +6302,7 @@ module.exports = require("path");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("stream");; module.exports = require("stream");
/***/ }), /***/ }),
@ -6310,7 +6310,7 @@ module.exports = require("stream");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("tls");; module.exports = require("tls");
/***/ }), /***/ }),
@ -6318,7 +6318,7 @@ module.exports = require("tls");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("url");; module.exports = require("url");
/***/ }), /***/ }),
@ -6326,7 +6326,7 @@ module.exports = require("url");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("util");; module.exports = require("util");
/***/ }), /***/ }),
@ -6334,7 +6334,7 @@ module.exports = require("util");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("zlib");; module.exports = require("zlib");
/***/ }) /***/ })
@ -6373,7 +6373,9 @@ module.exports = require("zlib");;
/************************************************************************/ /************************************************************************/
/******/ /* webpack/runtime/compat */ /******/ /* webpack/runtime/compat */
/******/ /******/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
/******/
/************************************************************************/
/******/ /******/
/******/ // startup /******/ // startup
/******/ // Load entry module and return exports /******/ // Load entry module and return exports

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

22
lib/config.js generated
View file

@ -25,32 +25,32 @@ const core = __importStar(require("@actions/core"));
const github_1 = require("@actions/github"); const github_1 = require("@actions/github");
const fs_1 = require("fs"); const fs_1 = require("fs");
exports.pullRequestNumber = ((_b = (_a = github_1.context === null || github_1.context === void 0 ? void 0 : github_1.context.payload) === null || _a === void 0 ? void 0 : _a.pull_request) === null || _b === void 0 ? void 0 : _b.number) || exports.pullRequestNumber = ((_b = (_a = github_1.context === null || github_1.context === void 0 ? void 0 : github_1.context.payload) === null || _a === void 0 ? void 0 : _a.pull_request) === null || _b === void 0 ? void 0 : _b.number) ||
+core.getInput('number', { required: false }); +core.getInput("number", { required: false });
exports.repo = buildRepo(); exports.repo = buildRepo();
exports.header = core.getInput('header', { required: false }); exports.header = core.getInput("header", { required: false });
exports.append = core.getBooleanInput('append', { required: true }); exports.append = core.getBooleanInput("append", { required: true });
exports.recreate = core.getBooleanInput('recreate', { required: true }); exports.recreate = core.getBooleanInput("recreate", { required: true });
exports.deleteOldComment = core.getBooleanInput('delete', { required: true }); exports.deleteOldComment = core.getBooleanInput("delete", { required: true });
exports.githubToken = core.getInput('GITHUB_TOKEN', { required: true }); exports.githubToken = core.getInput("GITHUB_TOKEN", { required: true });
exports.body = buildBody(); exports.body = buildBody();
function buildRepo() { function buildRepo() {
return { return {
owner: github_1.context.repo.owner, owner: github_1.context.repo.owner,
repo: core.getInput('repo', { required: false }) || github_1.context.repo.repo repo: core.getInput("repo", { required: false }) || github_1.context.repo.repo
}; };
} }
function buildBody() { function buildBody() {
const path = core.getInput('path', { required: false }); const path = core.getInput("path", { required: false });
if (path) { if (path) {
try { try {
return fs_1.readFileSync(path, 'utf-8'); return fs_1.readFileSync(path, "utf-8");
} }
catch (error) { catch (error) {
core.setFailed(error.message); core.setFailed(error.message);
return ''; return "";
} }
} }
else { else {
return core.getInput('message', { required: false }); return core.getInput("message", { required: false });
} }
} }

6
lib/main.js generated
View file

@ -35,15 +35,15 @@ const config_1 = require("./config");
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (isNaN(config_1.pullRequestNumber) || config_1.pullRequestNumber < 1) { if (isNaN(config_1.pullRequestNumber) || config_1.pullRequestNumber < 1) {
core.info('no pull request numbers given: skip step'); core.info("no pull request numbers given: skip step");
return; return;
} }
try { try {
if (!config_1.deleteOldComment && !config_1.body) { if (!config_1.deleteOldComment && !config_1.body) {
throw new Error('Either message or path input is required'); throw new Error("Either message or path input is required");
} }
if (config_1.deleteOldComment && config_1.recreate) { if (config_1.deleteOldComment && config_1.recreate) {
throw new Error('delete and recreate cannot be both set to true'); throw new Error("delete and recreate cannot be both set to true");
} }
const octokit = github.getOctokit(config_1.githubToken); const octokit = github.getOctokit(config_1.githubToken);
const previous = yield comment_1.findPreviousComment(octokit, config_1.repo, config_1.pullRequestNumber, config_1.header); const previous = yield comment_1.findPreviousComment(octokit, config_1.repo, config_1.pullRequestNumber, config_1.header);