|
1 | | -name: Binary Size Check |
| 1 | +name: Binary Size Check - Build |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | pull_request: |
5 | 5 | types: ["opened", "reopened", "synchronize"] |
6 | | - # Disable push events for now because of the permission issue |
7 | | - # push: |
8 | | - # branches: |
9 | | - # - main |
10 | 6 |
|
11 | 7 | env: |
12 | 8 | CI: 1 |
|
23 | 19 | measure-binary-size: |
24 | 20 | name: Measure Binary Size |
25 | 21 | runs-on: ubuntu-latest |
| 22 | + # No special permissions needed - this workflow only reads and uploads artifacts |
26 | 23 | permissions: |
27 | | - pull-requests: write |
28 | 24 | contents: read |
29 | 25 | steps: |
30 | 26 | - uses: actions/checkout@v4 |
@@ -77,56 +73,15 @@ jobs: |
77 | 73 | echo "" >> size_report.md |
78 | 74 | echo "*Commit: ${{ github.sha }}*" >> size_report.md |
79 | 75 |
|
80 | | - - name: Find existing comment |
81 | | - if: github.event_name == 'pull_request' |
82 | | - uses: peter-evans/find-comment@v3 |
83 | | - id: find-comment |
84 | | - with: |
85 | | - issue-number: ${{ github.event.pull_request.number }} |
86 | | - comment-author: "github-actions[bot]" |
87 | | - body-includes: "## Binary Sizes" |
| 76 | + - name: Save PR number |
| 77 | + run: | |
| 78 | + echo "${{ github.event.pull_request.number }}" > pr_number.txt |
88 | 79 |
|
89 | | - - name: Create or update PR comment |
90 | | - if: github.event_name == 'pull_request' |
91 | | - uses: peter-evans/create-or-update-comment@v4 |
| 80 | + - name: Upload size report and PR info |
| 81 | + uses: actions/upload-artifact@v4 |
92 | 82 | with: |
93 | | - comment-id: ${{ steps.find-comment.outputs.comment-id }} |
94 | | - issue-number: ${{ github.event.pull_request.number }} |
95 | | - body-path: size_report.md |
96 | | - edit-mode: replace |
97 | | - |
98 | | - - name: Find existing commit comment |
99 | | - if: github.event_name == 'push' |
100 | | - id: find-commit-comment |
101 | | - run: | |
102 | | - COMMENTS=$(gh api repos/${{ github.repository }}/commits/${{ github.sha }}/comments \ |
103 | | - --jq '.[] | select(.body | contains("## Binary Sizes")) | .id' | head -n 1) |
104 | | -
|
105 | | - if [ -n "$COMMENTS" ]; then |
106 | | - echo "comment_id=$COMMENTS" >> $GITHUB_OUTPUT |
107 | | - else |
108 | | - echo "comment_id=" >> $GITHUB_OUTPUT |
109 | | - fi |
110 | | - env: |
111 | | - GH_TOKEN: ${{ github.token }} |
112 | | - |
113 | | - - name: Create or update commit comment |
114 | | - if: github.event_name == 'push' |
115 | | - run: | |
116 | | - BODY=$(cat size_report.md) |
117 | | -
|
118 | | - if [ -n "${{ steps.find-commit-comment.outputs.comment_id }}" ]; then |
119 | | - gh api \ |
120 | | - --method PATCH \ |
121 | | - -H "Accept: application/vnd.github+json" \ |
122 | | - repos/${{ github.repository }}/comments/${{ steps.find-commit-comment.outputs.comment_id }} \ |
123 | | - -f body="$BODY" |
124 | | - else |
125 | | - gh api \ |
126 | | - --method POST \ |
127 | | - -H "Accept: application/vnd.github+json" \ |
128 | | - repos/${{ github.repository }}/commits/${{ github.sha }}/comments \ |
129 | | - -f body="$BODY" |
130 | | - fi |
131 | | - env: |
132 | | - GH_TOKEN: ${{ github.token }} |
| 83 | + name: size-report |
| 84 | + path: | |
| 85 | + size_report.md |
| 86 | + pr_number.txt |
| 87 | + retention-days: 1 |
0 commit comments