Skip to content

Commit

Permalink
Update distribution (#210)
Browse files Browse the repository at this point in the history
Co-authored-by: peter-evans <peter-evans@users.noreply.github.com>
  • Loading branch information
actions-bot and peter-evans committed Jun 8, 2023
1 parent ce3fa35 commit c6c9a1a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions dist/index.js
Expand Up @@ -128,13 +128,17 @@ function appendSeparatorTo(body, separator) {
return body;
}
}
function truncateBody(body) {
// 65536 characters is the maximum allowed for issue comments.
if (body.length > 65536) {
core.warning(`Comment body is too long. Truncating to 65536 characters.`);
return body.substring(0, 65536);
}
return body;
}
function createComment(octokit, owner, repo, issueNumber, body) {
return __awaiter(this, void 0, void 0, function* () {
// 65536 characters is the maximum allowed for issue comments.
if (body.length > 65536) {
core.warning(`Comment body is too long. Truncating to 65536 characters.`);
body = body.substring(0, 65536);
}
body = truncateBody(body);
const { data: comment } = yield octokit.rest.issues.createComment({
owner: owner,
repo: repo,
Expand All @@ -158,7 +162,7 @@ function updateComment(octokit, owner, repo, commentId, body, editMode, appendSe
});
commentBody = appendSeparatorTo(comment.body ? comment.body : '', appendSeparator);
}
commentBody = commentBody + body;
commentBody = truncateBody(commentBody + body);
core.debug(`Comment body: ${commentBody}`);
yield octokit.rest.issues.updateComment({
owner: owner,
Expand Down

0 comments on commit c6c9a1a

Please sign in to comment.