Skip to content

Commit 0204739

Browse files
committed
#2397: limit maximum length of clang-format output
1 parent 97c58c6 commit 0204739

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/run-clang-format.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,15 @@ jobs:
3636
}
3737
}
3838
39-
const fs = require("fs").promises
40-
var output = await fs.readFile("clang-format.diff")
41-
const commentBody = '`clang-format` output for this changeset:\n```diff\n' + output + '\n```'
39+
const fs = require("fs")
40+
var output = fs.readFileSync("clang-format.diff", "utf8")
41+
// make sure not to exceed maximum length of the comment
42+
output = (output.length > 65000) ?
43+
output.substring(0, 65000) + '\n(...)' : output
44+
const commentBody =
45+
'`clang-format` output for this changeset:\n```diff\n' +
46+
output + '\n```'
47+
4248
if (commentId === -1) {
4349
await github.rest.issues.createComment({
4450
owner: context.repo.owner,

0 commit comments

Comments
 (0)