mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2025-12-14 04:21:14 +00:00
Don't make api call when body is empty
This commit is contained in:
parent
1c0044770b
commit
2350aa6ad6
2 changed files with 5 additions and 5 deletions
|
|
@ -44,15 +44,15 @@ exports.findPreviousComment = findPreviousComment;
|
|||
function updateComment(octokit, repo, comment_id, body, header, previousBody) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!body && !previousBody)
|
||||
core.warning('Comment body cannot be blank');
|
||||
return core.warning('Comment body cannot be blank');
|
||||
yield octokit.issues.updateComment(Object.assign(Object.assign({}, repo), { comment_id, body: previousBody ? `${previousBody}\n${body}` : `${body}\n${headerComment(header)}` }));
|
||||
});
|
||||
}
|
||||
exports.updateComment = updateComment;
|
||||
function createComment(octokit, repo, issue_number, body, header, previousBody) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!body)
|
||||
core.warning('Comment body cannot be blank');
|
||||
if (!body && !previousBody)
|
||||
return core.warning('Comment body cannot be blank');
|
||||
yield octokit.issues.createComment(Object.assign(Object.assign({}, repo), { issue_number, body: previousBody ? `${previousBody}\n${body}` : `${body}\n${headerComment(header)}` }));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export async function findPreviousComment(octokit, repo, issue_number, header) {
|
|||
return comments.find(comment => comment.body.includes(h));
|
||||
}
|
||||
export async function updateComment(octokit, repo, comment_id, body, header, previousBody?) {
|
||||
if (!body && !previousBody) core.warning('Comment body cannot be blank');
|
||||
if (!body && !previousBody) return core.warning('Comment body cannot be blank');
|
||||
|
||||
await octokit.issues.updateComment({
|
||||
...repo,
|
||||
|
|
@ -22,7 +22,7 @@ export async function updateComment(octokit, repo, comment_id, body, header, pre
|
|||
});
|
||||
}
|
||||
export async function createComment(octokit, repo, issue_number, body, header, previousBody?) {
|
||||
if (!body) core.warning('Comment body cannot be blank');
|
||||
if (!body && !previousBody) return core.warning('Comment body cannot be blank');
|
||||
|
||||
await octokit.issues.createComment({
|
||||
...repo,
|
||||
|
|
|
|||
Loading…
Reference in a new issue