diff --git a/.github/workflows/read-size.yml b/.github/workflows/read-size.yml index 9d8a8cc10778d5..e767fc3ad2be55 100644 --- a/.github/workflows/read-size.yml +++ b/.github/workflows/read-size.yml @@ -42,7 +42,7 @@ jobs: TREESHAKEN_GZIP=$(stat --format=%s test/treeshake/index.bundle.min.js.gz) # write the output in a json file to upload it as artifact - node -pe "JSON.stringify({ filesize: $FILESIZE, gzip: $FILESIZE_GZIP, treeshaken: $TREESHAKEN, treeshakenGzip: $TREESHAKEN_GZIP })" > sizes.json + node -pe "JSON.stringify({ filesize: $FILESIZE, gzip: $FILESIZE_GZIP, treeshaken: $TREESHAKEN, treeshakenGzip: $TREESHAKEN_GZIP, pr: ${{ github.event.pull_request.number }} })" > sizes.json - name: Upload artifact uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/report-size.yml b/.github/workflows/report-size.yml index a563453bc0bf51..0d85c3e7871603 100644 --- a/.github/workflows/report-size.yml +++ b/.github/workflows/report-size.yml @@ -21,6 +21,11 @@ jobs: if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' steps: + - name: Log GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + # Using actions/download-artifact doesn't work here # https://github.com/actions/download-artifact/issues/60 - name: Download artifact @@ -101,13 +106,13 @@ jobs: uses: peter-evans/find-comment@v2 id: find-comment with: - issue-number: ${{ github.event.workflow_run.pull_requests[0].number }} + issue-number: ${{ fromJSON(steps.download-artifact.outputs.result).pr }} comment-author: 'github-actions[bot]' body-includes: Bundle size - name: Comment on PR uses: peter-evans/create-or-update-comment@v2 with: - issue-number: ${{ github.event.workflow_run.pull_requests[0].number }} + issue-number: ${{ fromJSON(steps.download-artifact.outputs.result).pr }} comment-id: ${{ steps.find-comment.outputs.comment-id }} edit-mode: replace body: |