From 93d08d06a82da1f41b2876a5b7dd839da8efb867 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Sun, 3 Nov 2024 10:38:26 +0100 Subject: [PATCH] Minor adjustments after #2269 --- .../dist-files-size-diff-comment.yaml | 20 +++++++++++++++---- .github/workflows/dist-files-size-diff.yaml | 18 ++++++++++++++--- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dist-files-size-diff-comment.yaml b/.github/workflows/dist-files-size-diff-comment.yaml index d43f79c0a7..40d1e928b2 100644 --- a/.github/workflows/dist-files-size-diff-comment.yaml +++ b/.github/workflows/dist-files-size-diff-comment.yaml @@ -10,13 +10,25 @@ jobs: dist-files-size-diff: runs-on: ubuntu-latest steps: - - name: Download artifact + - name: Download dist-size-diff artifact uses: actions/download-artifact@v4 with: - name: dist-size-${{ github.event.number }} + name: dist-size-diff + run-id: ${{ github.event.workflow_run.id }} + + - name: Download pr-number artifact + uses: actions/download-artifact@v4 + with: + name: pr-number + run-id: ${{ github.event.workflow_run.id }} + + - name: Read pr-number artifact to env var + id: read-pr-number + run: | + echo "::set-output name=pr-number::$(cat ./pr-number)" - name: Comment on the pull request (if success) - if: ${{ always() && steps.diff.conclusion == 'success' }} uses: marocchino/sticky-pull-request-comment@v2 with: - path: ./dist-size.md + number: ${{ steps.read-pr-number.outputs.pr-number }} + path: ./dist-size-diff.md diff --git a/.github/workflows/dist-files-size-diff.yaml b/.github/workflows/dist-files-size-diff.yaml index b690047dec..f6957733f2 100644 --- a/.github/workflows/dist-files-size-diff.yaml +++ b/.github/workflows/dist-files-size-diff.yaml @@ -59,10 +59,22 @@ jobs: const diff = await main() console.log(diff); - fs.writeFileSync(process.env.GITHUB_WORKSPACE + '/dist-size.md', diff) + fs.writeFileSync(process.env.GITHUB_WORKSPACE + '/dist-size-diff.md', diff) - name: Upload the diff uses: actions/upload-artifact@v4 with: - name: dist-size-${{ github.event.number }} - path: ./dist-size.md + name: dist-size-diff + path: ./dist-size-diff.md + + - name: Save PR number + env: + PR_NUMBER: ${{ github.event.number }} + run: | + echo $PR_NUMBER > ./pr-number + + - name: Upload the PR number + uses: actions/upload-artifact@v4 + with: + name: pr-number + path: ./pr-number