-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
51 lines (45 loc) · 1.42 KB
/
binary-size-comment.yml
File metadata and controls
51 lines (45 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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 run on successful builds
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: size-report
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Read PR number
id: pr
run: |
PR_NUMBER=$(cat pr_number.txt)
echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT
- name: Find existing comment
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ steps.pr.outputs.number }}
comment-author: "github-actions[bot]"
body-includes: "## Binary Sizes"
- name: Create or update PR comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ steps.pr.outputs.number }}
body-path: size_report.md
edit-mode: replace