Skip to content

Commit a2e6eb0

Browse files
committed
Run PR comment posting as separate job with appropriate permissions.
1 parent 0ddc036 commit a2e6eb0

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

.github/workflows/check-binary-size.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ jobs:
2020
TEST_MAIN_RS: foo.rs
2121
BASE_COMMIT: ${{ github.event.pull_request.base.sha }}
2222
HEAD_COMMIT: ${{ github.event.pull_request.head.sha }}
23+
outputs:
24+
binary-size-reference:
25+
description: The size in bytes of the test binary built from the PR base
26+
value: ${{ steps.size-reference.outputs.test-binary-size }}
27+
binary-size-updated:
28+
description: The size in bytes of the test binary built from the PR head
29+
value: ${{ steps.size-updated.outputs.test-binary-size }}
2330
steps:
2431
- name: Print info
2532
run: |
@@ -74,11 +81,18 @@ jobs:
7481
main-rs: ${{ env.TEST_MAIN_RS }}
7582
rustc-dir: ${{ env.RUSTC_DIR }}
7683
id: size-updated
84+
report:
85+
name: Report binary size changes
86+
runs-on: ubuntu-latest
87+
needs: measure
88+
permissions:
89+
pull-request: write
90+
steps:
7791
- name: Post a PR comment if the size has changed
7892
uses: actions/github-script@v6
7993
env:
80-
SIZE_REFERENCE: ${{ steps.size-reference.outputs.test-binary-size }}
81-
SIZE_UPDATED: ${{ steps.size-updated.outputs.test-binary-size }}
94+
SIZE_REFERENCE: ${{ needs.measure.outputs.binary-size-reference }}
95+
SIZE_UPDATED: ${{ needs.measure.outputs.binary-size-reference }}
8296
with:
8397
script: |
8498
const reference = process.env.SIZE_REFERENCE;

0 commit comments

Comments
 (0)