Skip to content

Commit

Permalink
Run PR comment posting as separate job with appropriate permissions.
Browse files Browse the repository at this point in the history
  • Loading branch information
detly committed Jul 18, 2023
1 parent 0ddc036 commit 62c9cb0
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/check-binary-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ jobs:
TEST_MAIN_RS: foo.rs
BASE_COMMIT: ${{ github.event.pull_request.base.sha }}
HEAD_COMMIT: ${{ github.event.pull_request.head.sha }}
outputs:
binary-size-reference:
description: The size in bytes of the test binary built from the PR base
value: ${{ steps.size-reference.outputs.test-binary-size }}
binary-size-updated:
description: The size in bytes of the test binary built from the PR head
value: ${{ steps.size-updated.outputs.test-binary-size }}
steps:
- name: Print info
run: |
Expand Down Expand Up @@ -74,11 +81,17 @@ jobs:
main-rs: ${{ env.TEST_MAIN_RS }}
rustc-dir: ${{ env.RUSTC_DIR }}
id: size-updated
report:
name: Report binary size changes
runs-on: ubuntu-latest
needs: measure
permissions:
pull-request: write
- name: Post a PR comment if the size has changed
uses: actions/github-script@v6
env:
SIZE_REFERENCE: ${{ steps.size-reference.outputs.test-binary-size }}
SIZE_UPDATED: ${{ steps.size-updated.outputs.test-binary-size }}
SIZE_REFERENCE: ${{ needs.measure.outputs.binary-size-reference }}
SIZE_UPDATED: ${{ needs.measure.outputs.binary-size-reference }}
with:
script: |
const reference = process.env.SIZE_REFERENCE;
Expand Down

0 comments on commit 62c9cb0

Please sign in to comment.