mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2025-12-15 12:46:30 +00:00
📦️ build
This commit is contained in:
parent
3a69964ff4
commit
f6a2580ed5
2 changed files with 14 additions and 8 deletions
20
dist/index.js
generated
vendored
20
dist/index.js
generated
vendored
|
|
@ -121,9 +121,11 @@ function updateComment(octokit, id, body, header, previousBody) {
|
||||||
exports.updateComment = updateComment;
|
exports.updateComment = updateComment;
|
||||||
function createComment(octokit, repo, issue_number, body, header, previousBody) {
|
function createComment(octokit, repo, issue_number, body, header, previousBody) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (!body && !previousBody)
|
if (!body && !previousBody) {
|
||||||
return core.warning("Comment body cannot be blank");
|
core.warning("Comment body cannot be blank");
|
||||||
yield octokit.rest.issues.createComment(Object.assign(Object.assign({}, repo), { issue_number, body: previousBody
|
return;
|
||||||
|
}
|
||||||
|
return yield octokit.rest.issues.createComment(Object.assign(Object.assign({}, repo), { issue_number, body: previousBody
|
||||||
? `${previousBody}\n${body}`
|
? `${previousBody}\n${body}`
|
||||||
: `${body}\n${headerComment(header)}` }));
|
: `${body}\n${headerComment(header)}` }));
|
||||||
});
|
});
|
||||||
|
|
@ -144,7 +146,7 @@ exports.deleteComment = deleteComment;
|
||||||
function minimizeComment(octokit, subjectId, classifier) {
|
function minimizeComment(octokit, subjectId, classifier) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
yield octokit.graphql(`
|
yield octokit.graphql(`
|
||||||
mutation($input: MinimizeCommentInput!) {
|
mutation($input: MinimizeCommentInput!) {
|
||||||
minimizeComment(input: $input) {
|
minimizeComment(input: $input) {
|
||||||
clientMutationId
|
clientMutationId
|
||||||
}
|
}
|
||||||
|
|
@ -346,6 +348,7 @@ function run() {
|
||||||
}
|
}
|
||||||
const octokit = github.getOctokit(config_1.githubToken);
|
const octokit = github.getOctokit(config_1.githubToken);
|
||||||
const previous = yield (0, comment_1.findPreviousComment)(octokit, config_1.repo, config_1.pullRequestNumber, config_1.header);
|
const previous = yield (0, comment_1.findPreviousComment)(octokit, config_1.repo, config_1.pullRequestNumber, config_1.header);
|
||||||
|
core.setOutput("previous_comment_id", previous === null || previous === void 0 ? void 0 : previous.id);
|
||||||
if (config_1.deleteOldComment) {
|
if (config_1.deleteOldComment) {
|
||||||
if (previous) {
|
if (previous) {
|
||||||
yield (0, comment_1.deleteComment)(octokit, previous.id);
|
yield (0, comment_1.deleteComment)(octokit, previous.id);
|
||||||
|
|
@ -356,7 +359,8 @@ function run() {
|
||||||
if (config_1.onlyUpdateComment) {
|
if (config_1.onlyUpdateComment) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, body, config_1.header);
|
const created = yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, body, config_1.header);
|
||||||
|
core.setOutput("created_comment_id", created === null || created === void 0 ? void 0 : created.data.id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (config_1.onlyCreateComment) {
|
if (config_1.onlyCreateComment) {
|
||||||
|
|
@ -371,12 +375,14 @@ function run() {
|
||||||
const previousBody = (0, comment_1.getBodyOf)(previous, config_1.append, config_1.hideDetails);
|
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, previous.id);
|
yield (0, comment_1.deleteComment)(octokit, previous.id);
|
||||||
yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, body, config_1.header, previousBody);
|
const created = yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, body, config_1.header, previousBody);
|
||||||
|
core.setOutput("created_comment_id", created === null || created === void 0 ? void 0 : created.data.id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (config_1.hideAndRecreate) {
|
if (config_1.hideAndRecreate) {
|
||||||
yield (0, comment_1.minimizeComment)(octokit, previous.id, config_1.hideClassify);
|
yield (0, comment_1.minimizeComment)(octokit, previous.id, config_1.hideClassify);
|
||||||
yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, body, config_1.header);
|
const created = yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, body, config_1.header);
|
||||||
|
core.setOutput("created_comment_id", created === null || created === void 0 ? void 0 : created.data.id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
yield (0, comment_1.updateComment)(octokit, previous.id, body, config_1.header, previousBody);
|
yield (0, comment_1.updateComment)(octokit, previous.id, body, config_1.header, previousBody);
|
||||||
|
|
|
||||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue