From e242a7580bc70bb9c5ea8fd773c58a49c11773cc Mon Sep 17 00:00:00 2001 From: Shantanu Jain Date: Wed, 8 Jan 2025 16:00:31 -0800 Subject: [PATCH] Fix mypy_primer comment workflow --- .github/workflows/mypy_primer_comment.yml | 25 +++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/mypy_primer_comment.yml b/.github/workflows/mypy_primer_comment.yml index e484589ad446..be0dda7f7dec 100644 --- a/.github/workflows/mypy_primer_comment.yml +++ b/.github/workflows/mypy_primer_comment.yml @@ -17,12 +17,6 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - - name: Hide old comments - uses: kanga333/comment-hider@c12bb20b48aeb8fc098e35967de8d4f8018fffdf # v0.4.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - issue_number: ${{ steps.post-comment.outputs.result }} - - name: Download diffs uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: @@ -45,8 +39,22 @@ jobs: fs.writeFileSync("diff.zip", Buffer.from(download.data)); - run: unzip diff.zip - - run: | - cat diff_*.txt | tee fulldiff.txt + + - name: Get PR number + id: get-pr-number + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + const fs = require('fs'); + return parseInt(fs.readFileSync("pr_number.txt", { encoding: "utf8" })) + + - name: Hide old comments + uses: kanga333/comment-hider@c12bb20b48aeb8fc098e35967de8d4f8018fffdf # v0.4.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + issue_number: ${{ steps.get-pr-number.outputs.result }} + + - run: cat diff_*.txt | tee fulldiff.txt - name: Post comment id: post-comment @@ -93,4 +101,3 @@ jobs: body }) } - return prNumber