📦 build

This commit is contained in:
marocchino 2021-09-29 02:53:40 +09:00
parent 4a83f71279
commit 0fbcad7795
No known key found for this signature in database
GPG key ID: AFF521DBDB122570
5 changed files with 35 additions and 7 deletions

20
dist/index.js generated vendored
View file

@ -35,7 +35,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.deleteComment = exports.createComment = exports.updateComment = exports.findPreviousComment = void 0; exports.getBodyOf = exports.deleteComment = exports.createComment = exports.updateComment = exports.findPreviousComment = void 0;
const core = __importStar(__nccwpck_require__(186)); const core = __importStar(__nccwpck_require__(186));
function headerComment(header) { function headerComment(header) {
return `<!-- Sticky Pull Request Comment${header} -->`; return `<!-- Sticky Pull Request Comment${header} -->`;
@ -75,6 +75,17 @@ function deleteComment(octokit, repo, comment_id) {
}); });
} }
exports.deleteComment = deleteComment; exports.deleteComment = deleteComment;
function getBodyOf(previous, append, hideDetails) {
var _a;
if (!append) {
return undefined;
}
if (!hideDetails) {
return previous.body;
}
return (_a = previous.body) === null || _a === void 0 ? void 0 : _a.replace(/(<details.*?)\s*\bopen\b(.*>)/g, "$1$2");
}
exports.getBodyOf = getBodyOf;
/***/ }), /***/ }),
@ -105,7 +116,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
}; };
var _a, _b; var _a, _b;
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.body = exports.githubToken = exports.deleteOldComment = exports.recreate = exports.append = exports.header = exports.repo = exports.pullRequestNumber = void 0; exports.body = exports.githubToken = exports.deleteOldComment = exports.recreate = exports.hideDetails = exports.append = exports.header = exports.repo = exports.pullRequestNumber = void 0;
const core = __importStar(__nccwpck_require__(186)); const core = __importStar(__nccwpck_require__(186));
const github_1 = __nccwpck_require__(438); const github_1 = __nccwpck_require__(438);
const fs_1 = __nccwpck_require__(747); const fs_1 = __nccwpck_require__(747);
@ -114,6 +125,9 @@ exports.pullRequestNumber = ((_b = (_a = github_1.context === null || github_1.c
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.hideDetails = core.getBooleanInput("hide_details", {
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 });
@ -206,7 +220,7 @@ function run() {
yield (0, comment_1.deleteComment)(octokit, config_1.repo, previous.id); yield (0, comment_1.deleteComment)(octokit, config_1.repo, previous.id);
return; return;
} }
const previousBody = config_1.append ? previous.body : undefined; const previousBody = (0, comment_1.getBodyOf)(previous, config_1.append, config_1.hideDetails);
if (config_1.recreate) { if (config_1.recreate) {
yield (0, comment_1.deleteComment)(octokit, config_1.repo, previous.id); yield (0, comment_1.deleteComment)(octokit, config_1.repo, previous.id);
yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, config_1.body, config_1.header, previousBody); yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, config_1.body, config_1.header, previousBody);

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

13
lib/comment.js generated
View file

@ -28,7 +28,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.deleteComment = exports.createComment = exports.updateComment = exports.findPreviousComment = void 0; exports.getBodyOf = exports.deleteComment = exports.createComment = exports.updateComment = exports.findPreviousComment = void 0;
const core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
function headerComment(header) { function headerComment(header) {
return `<!-- Sticky Pull Request Comment${header} -->`; return `<!-- Sticky Pull Request Comment${header} -->`;
@ -68,3 +68,14 @@ function deleteComment(octokit, repo, comment_id) {
}); });
} }
exports.deleteComment = deleteComment; exports.deleteComment = deleteComment;
function getBodyOf(previous, append, hideDetails) {
var _a;
if (!append) {
return undefined;
}
if (!hideDetails) {
return previous.body;
}
return (_a = previous.body) === null || _a === void 0 ? void 0 : _a.replace(/(<details.*?)\s*\bopen\b(.*>)/g, "$1$2");
}
exports.getBodyOf = getBodyOf;

5
lib/config.js generated
View file

@ -20,7 +20,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
}; };
var _a, _b; var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.body = exports.githubToken = exports.deleteOldComment = exports.recreate = exports.append = exports.header = exports.repo = exports.pullRequestNumber = void 0; exports.body = exports.githubToken = exports.deleteOldComment = exports.recreate = exports.hideDetails = exports.append = exports.header = exports.repo = exports.pullRequestNumber = void 0;
const core = __importStar(require("@actions/core")); 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");
@ -29,6 +29,9 @@ exports.pullRequestNumber = ((_b = (_a = github_1.context === null || github_1.c
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.hideDetails = core.getBooleanInput("hide_details", {
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 });

2
lib/main.js generated
View file

@ -55,7 +55,7 @@ function run() {
yield (0, comment_1.deleteComment)(octokit, config_1.repo, previous.id); yield (0, comment_1.deleteComment)(octokit, config_1.repo, previous.id);
return; return;
} }
const previousBody = config_1.append ? previous.body : undefined; const previousBody = (0, comment_1.getBodyOf)(previous, config_1.append, config_1.hideDetails);
if (config_1.recreate) { if (config_1.recreate) {
yield (0, comment_1.deleteComment)(octokit, config_1.repo, previous.id); yield (0, comment_1.deleteComment)(octokit, config_1.repo, previous.id);
yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, config_1.body, config_1.header, previousBody); yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, config_1.body, config_1.header, previousBody);