From 947a871a1c0099c93b607db019af4dcefdbecb2b Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Mon, 21 Mar 2022 14:29:35 -0700 Subject: [PATCH] mypy_primer: mention if output is truncated --- .github/workflows/mypy_primer_comment.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mypy_primer_comment.yml b/.github/workflows/mypy_primer_comment.yml index 9aa5b7a7131e..6942efc78e8c 100644 --- a/.github/workflows/mypy_primer_comment.yml +++ b/.github/workflows/mypy_primer_comment.yml @@ -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` + } console.log("Diff from mypy_primer:") console.log(data)