mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2025-12-15 20:56:31 +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) {
|
function headerComment(header) {
|
||||||
return `<!-- Sticky Pull Request Comment${header} -->`;
|
return `<!-- Sticky Pull Request Comment${header} -->`;
|
||||||
}
|
}
|
||||||
function removeHeaderComment(body, header) {
|
|
||||||
return body.replace(`\n${header}`, '');
|
|
||||||
}
|
|
||||||
function findPreviousComment(octokit, repo, issue_number, header) {
|
function findPreviousComment(octokit, repo, issue_number, header) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const { data: comments } = yield octokit.issues.listComments(Object.assign(Object.assign({}, repo), { issue_number }));
|
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;
|
exports.findPreviousComment = findPreviousComment;
|
||||||
function updateComment(octokit, repo, comment_id, body, header, previousBody) {
|
function updateComment(octokit, repo, comment_id, body, header, previousBody) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const headerIdentifier = headerComment(header);
|
yield octokit.issues.updateComment(Object.assign(Object.assign({}, repo), { comment_id, body: previousBody ? `${previousBody}\n${body}` : `${body}\n${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}` }));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.updateComment = updateComment;
|
exports.updateComment = updateComment;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue