Skip to content

Commit

Permalink
Truncate issue comments (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey authored Jul 23, 2024
1 parent 61b749a commit 06a65d2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/utils/gitUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,16 @@ export async function createIssue(postResult: boolean, title: string, bodyChunks
const issueNumber = created.data.number;
console.log(`Created issue #${issueNumber}: ${created.data.html_url}`);

const maxCommentLength = 65535;
const tooLongFooter = `\n\nThis comment was too long to display in full; see the build artifact for the full details.`;

for (const comment of additionalComments) {
await kit.issues.createComment({ issue_number: issueNumber, ...comment });
let body = comment.body;
if (body.length > maxCommentLength) {
body = body.slice(0, maxCommentLength - tooLongFooter.length) + tooLongFooter;
}

await kit.issues.createComment({ issue_number: issueNumber, ...comment, body });
}

if (!sawNewErrors) {
Expand Down

0 comments on commit 06a65d2

Please sign in to comment.