Skip to content

Commit 4de8061

Browse files
authored
mypy_primer: mention if output is truncated (#12419)
Co-authored-by: hauntsaninja <>
1 parent 27938e7 commit 4de8061

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/mypy_primer_comment.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ jobs:
3838
fs.writeFileSync("diff.zip", Buffer.from(download.data));
3939
4040
- run: unzip diff.zip
41-
# 30000 bytes is about 300 lines, posting comment fails if too long
4241
- run: |
43-
cat diff_*.txt | head -c 30000 | tee fulldiff.txt
42+
cat diff_*.txt | tee fulldiff.txt
4443
4544
- name: Post comment
4645
id: post-comment
@@ -49,7 +48,11 @@ jobs:
4948
github-token: ${{ secrets.GITHUB_TOKEN }}
5049
script: |
5150
const fs = require('fs')
52-
const data = fs.readFileSync('fulldiff.txt', { encoding: 'utf8' })
51+
let data = fs.readFileSync('fulldiff.txt', { encoding: 'utf8' })
52+
// posting comment fails if too long, so truncate
53+
if (data.length > 30000) {
54+
data = data.substring(0, 30000) + `\n\n... (truncated ${diff.length - 30000} chars) ...\n`
55+
}
5356
5457
console.log("Diff from mypy_primer:")
5558
console.log(data)

0 commit comments

Comments
 (0)