From f5be781aa31c9b299b5922a585dad38da9526900 Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Mon, 21 Mar 2022 14:15:44 -0700 Subject: [PATCH 1/2] mypy_primer: mention if output is truncated When changes are really disruptive, like #7430, we truncate output. Mention this, so that it's known that the change is even more disruptive than it might appear. --- .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 150099130634..9a741ac73416 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` + } let body if (data.trim()) { From b9f59efaee5fdce21f4cd9f5bc8fe6ae596a3b7b Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Mon, 21 Mar 2022 14:29:04 -0700 Subject: [PATCH 2/2] fix indent --- .github/workflows/mypy_primer_comment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mypy_primer_comment.yml b/.github/workflows/mypy_primer_comment.yml index 9a741ac73416..f0ad1e9f90c4 100644 --- a/.github/workflows/mypy_primer_comment.yml +++ b/.github/workflows/mypy_primer_comment.yml @@ -51,7 +51,7 @@ jobs: 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` + data = data.substring(0, 30000) + `\n\n... (truncated ${diff.length - 30000} chars) ...\n` } let body