mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2025-12-13 12:11:14 +00:00
📦️ Build
This commit is contained in:
parent
182fb2a468
commit
44e0bad810
2 changed files with 8 additions and 2 deletions
8
dist/index.js
generated
vendored
8
dist/index.js
generated
vendored
|
|
@ -53,6 +53,9 @@ function headerComment(header) {
|
|||
function bodyWithHeader(body, header) {
|
||||
return `${body}\n${headerComment(header)}`;
|
||||
}
|
||||
function bodyWithoutHeader(body, header) {
|
||||
return body.replace(`\n${headerComment(header)}`, "");
|
||||
}
|
||||
function findPreviousComment(octokit, repo, number, header) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
||||
|
|
@ -107,6 +110,9 @@ function updateComment(octokit, id, body, header, previousBody) {
|
|||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!body && !previousBody)
|
||||
return core.warning("Comment body cannot be blank");
|
||||
const rawPreviousBody = previousBody
|
||||
? bodyWithoutHeader(previousBody, header)
|
||||
: "";
|
||||
yield octokit.graphql(`
|
||||
mutation($input: UpdateIssueCommentInput!) {
|
||||
updateIssueComment(input: $input) {
|
||||
|
|
@ -120,7 +126,7 @@ function updateComment(octokit, id, body, header, previousBody) {
|
|||
input: {
|
||||
id,
|
||||
body: previousBody
|
||||
? `${previousBody}\n${body}`
|
||||
? bodyWithHeader(`${rawPreviousBody}\n${body}`, header)
|
||||
: bodyWithHeader(body, header)
|
||||
}
|
||||
});
|
||||
|
|
|
|||
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