mirror of
https://github.com/peter-evans/create-or-update-comment.git
synced 2025-01-18 19:22:44 +08:00
fix: truncate body when it exceeds the max length (#182)
This commit is contained in:
parent
3518fea64b
commit
ca08ebd5dc
5
dist/index.js
vendored
5
dist/index.js
vendored
@ -130,6 +130,11 @@ function appendSeparatorTo(body, separator) {
|
||||
}
|
||||
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);
|
||||
}
|
||||
const { data: comment } = yield octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
|
5126
package-lock.json
generated
5126
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -125,6 +125,12 @@ async function createComment(
|
||||
issueNumber: number,
|
||||
body: string
|
||||
): Promise<number> {
|
||||
// 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)
|
||||
}
|
||||
|
||||
const {data: comment} = await octokit.rest.issues.createComment({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
|
Loading…
x
Reference in New Issue
Block a user