Add truncate warning to body of comment (#272)
* Add truncate warning to body of comment (#271) * add truncate warning to body of comment * tweak warning Co-authored-by: Peter Evans <[email protected]> --------- Co-authored-by: Peter Evans <[email protected]> * lint fixes * update dist --------- Co-authored-by: Ethan Davidson <[email protected]>
This commit is contained in:
co-authored by
Ethan Davidson
parent
d85800fae5
commit
23ff15729e
Vendored
+2
-1
@@ -130,9 +130,10 @@ function appendSeparatorTo(body, separator) {
|
||||
}
|
||||
function truncateBody(body) {
|
||||
// 65536 characters is the maximum allowed for issue comments.
|
||||
const truncateWarning = '...*[Comment body truncated]*';
|
||||
if (body.length > 65536) {
|
||||
core.warning(`Comment body is too long. Truncating to 65536 characters.`);
|
||||
return body.substring(0, 65536);
|
||||
return body.substring(0, 65536 - truncateWarning.length) + truncateWarning;
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
@@ -120,9 +120,10 @@ function appendSeparatorTo(body: string, separator: string): string {
|
||||
|
||||
function truncateBody(body: string) {
|
||||
// 65536 characters is the maximum allowed for issue comments.
|
||||
const truncateWarning = '...*[Comment body truncated]*'
|
||||
if (body.length > 65536) {
|
||||
core.warning(`Comment body is too long. Truncating to 65536 characters.`)
|
||||
return body.substring(0, 65536)
|
||||
return body.substring(0, 65536 - truncateWarning.length) + truncateWarning
|
||||
}
|
||||
return body
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user