mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2025-12-14 12:31:14 +00:00
build
This commit is contained in:
parent
7a2cc8a3dc
commit
8c58ada506
1 changed files with 1 additions and 6 deletions
|
|
@ -13,9 +13,6 @@ exports.createComment = exports.updateComment = exports.findPreviousComment = vo
|
|||
function headerComment(header) {
|
||||
return `<!-- Sticky Pull Request Comment${header} -->`;
|
||||
}
|
||||
function removeHeaderComment(body, header) {
|
||||
return body.replace(`\n${header}`, '');
|
||||
}
|
||||
function findPreviousComment(octokit, repo, issue_number, header) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { data: comments } = yield octokit.issues.listComments(Object.assign(Object.assign({}, repo), { issue_number }));
|
||||
|
|
@ -26,9 +23,7 @@ function findPreviousComment(octokit, repo, issue_number, header) {
|
|||
exports.findPreviousComment = findPreviousComment;
|
||||
function updateComment(octokit, repo, comment_id, body, header, previousBody) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const headerIdentifier = headerComment(header);
|
||||
const updatedBody = previousBody ? `${removeHeaderComment(previousBody, headerIdentifier)}\n${body}` : body;
|
||||
yield octokit.issues.updateComment(Object.assign(Object.assign({}, repo), { comment_id, body: `${updatedBody}\n${headerIdentifier}` }));
|
||||
yield octokit.issues.updateComment(Object.assign(Object.assign({}, repo), { comment_id, body: previousBody ? `${previousBody}\n${body}` : `${body}\n${headerComment(header)}` }));
|
||||
});
|
||||
}
|
||||
exports.updateComment = updateComment;
|
||||
|
|
|
|||
Loading…
Reference in a new issue