Skip to content

Binary Size Check - Comment #1819

Binary Size Check - Comment

Binary Size Check - Comment #1819

name: Binary Size Check - Comment
on:
workflow_run:
workflows: ["Binary Size Check - Build"]
types:
- completed
env:
CI: 1
jobs:
comment-on-pr:
name: Comment on PR
runs-on: ubuntu-latest
# This workflow needs write permissions to comment on PRs
# It's safe because it doesn't execute any code from the PR
permissions:
pull-requests: write
contents: read
# Only comment for successful PR builds. Do not trust PR-provided artifacts
# to choose the target issue number.
if: >-
${{
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.pull_requests[0] != null
}}
steps:
- name: Download artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: size-report
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Find existing comment
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3
id: find-comment
with:
issue-number: ${{ github.event.workflow_run.pull_requests[0].number }}
comment-author: "github-actions[bot]"
body-includes: "## Binary Sizes"
- name: Create or update PR comment
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.workflow_run.pull_requests[0].number }}
body-path: size_report.md
edit-mode: replace