From ba0f2b929be1ec38e76382a846d6f48e4d50e8e9 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 15 Apr 2021 09:18:13 +0200 Subject: [PATCH] Always generate a comment for mypy_primer (#5197) This way, runs without output after runs with output can be clearly determined. This also makes it easier to recognize when a run was not completed. --- .github/workflows/mypy_primer_comment.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/mypy_primer_comment.yml b/.github/workflows/mypy_primer_comment.yml index 965607aed..b54dbd470 100644 --- a/.github/workflows/mypy_primer_comment.yml +++ b/.github/workflows/mypy_primer_comment.yml @@ -89,11 +89,15 @@ jobs: console.log("Diff from mypy_primer:") console.log(data) + let body; if (data.trim()) { - await github.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Diff from [mypy_primer](https://github.com/hauntsaninja/mypy_primer), showing the effect of this PR on open source code:\n```diff\n' + data + '```' - }) + body = 'Diff from [mypy_primer](https://github.com/hauntsaninja/mypy_primer), showing the effect of this PR on open source code:\n```diff\n' + data + '```' + } else { + body = 'According to [mypy_primer](https://github.com/hauntsaninja/mypy_primer), this change has no effect on the checked open source code. 🤖🎉' } + await github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body, + })