Don't make api call when body is empty

This commit is contained in:
Sebass van Boxel 2020-11-04 22:20:58 +01:00
parent 1c0044770b
commit 2350aa6ad6
No known key found for this signature in database
GPG key ID: A1E93D1FBDF515B7
2 changed files with 5 additions and 5 deletions

View file

@ -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)}` }));
});
}