mypy_primer: mention if output is truncated (#7525)

This commit is contained in:
Shantanu
2022-03-21 15:41:31 -07:00
committed by GitHub
parent fa9074366b
commit 0af746d048

View File

@@ -38,9 +38,8 @@ jobs:
fs.writeFileSync("diff.zip", Buffer.from(download.data));
- run: unzip diff.zip
# 30000 bytes is about 300 lines, posting comment fails if too long
- run: |
cat diff_*.txt | head -c 30000 | tee fulldiff.txt
cat diff_*.txt | tee fulldiff.txt
- name: Post comment
id: post-comment
@@ -49,7 +48,11 @@ jobs:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const fs = require('fs')
const data = fs.readFileSync('fulldiff.txt', { encoding: 'utf8' })
let data = fs.readFileSync('fulldiff.txt', { encoding: 'utf8' })
// posting comment fails if too long, so truncate
if (data.length > 30000) {
data = data.substring(0, 30000) + `\n\n... (truncated ${diff.length - 30000} chars) ...\n`
}
let body
if (data.trim()) {