Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
64 lines
1.8 KiB
YAML
64 lines
1.8 KiB
YAML
name: pr-size-test-result
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: [ios-ci]
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
comment-on-pr:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: ./.github/actions/download-workflow-run-artifact
|
|
with:
|
|
artifact-name: size-test-result
|
|
expect-files: "./size"
|
|
|
|
# Move ./size artifact to ./size_main and store as cache
|
|
|
|
- run: mv size size_main
|
|
if: github.event.workflow_run.event != 'pull_request'
|
|
|
|
- name: Save size
|
|
if: github.event.workflow_run.event != 'pull_request'
|
|
uses: actions/cache/save@v3
|
|
with:
|
|
path: |
|
|
size_main
|
|
key: ios-size
|
|
|
|
# Restore cache so we can output the difference
|
|
|
|
- name: Restore size
|
|
if: github.event.workflow_run.event == 'pull_request'
|
|
uses: actions/cache/restore@v3
|
|
with:
|
|
path: |
|
|
size_main
|
|
key: ios-size
|
|
|
|
- run: |
|
|
{
|
|
echo old_size="$(cat ./size_main)"
|
|
echo new_size="$(cat ./size)"
|
|
echo percentage_change="$(awk 'NR==FNR{a=$0;next}{printf "%+.2f%%\n", 100*($0-a)/a}' ./size ./size_main)"
|
|
} >> "$GITHUB_ENV"
|
|
if: github.event.workflow_run.event == 'pull_request'
|
|
|
|
- name: 'Leave comment on PR with test results'
|
|
if: github.event.workflow_run.event == 'pull_request'
|
|
uses: marocchino/sticky-pull-request-comment@v2
|
|
with:
|
|
header: size-test-result
|
|
number: ${{ github.event.workflow_run.pull_requests[0].number }}
|
|
message: |
|
|
### Size test result
|
|
|
|
Old size: ${{ env.old_size }} bytes
|
|
New size: ${{ env.new_size }} bytes
|
|
Difference: **${{ env.percentage_change }}**
|
|
|