Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit acd7c06

Browse files
committed
Test
1 parent 7e6e676 commit acd7c06

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/workflows/checksize.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,15 @@ jobs:
1313
run: docker build . --file Dockerfile.dummy --build-arg NF_IMAGE_VERSION=$GITHUB_SHA -t netlify/build:$GITHUB_SHA
1414
- name: Check image size
1515
run: |
16-
SIZE=$(docker image inspect netlify/build:$GITHUB_SHA --format='{{.Size}}')
17-
curl -d '{"name":"Image size", "head_sha":"${{ github.sha }}", "conclusion":"neutral", "output":{"title":"'$SIZE'", "summary":"foo"}}' \
16+
docker pull netlify/build:latest
17+
OLD=$(docker image inspect netlify/build:latest --format='{{.Size}}')
18+
NEW=$(docker image inspect netlify/build:$GITHUB_SHA --format='{{.Size}}')
19+
if (( NEW > OLD )); then
20+
MSG="PR image is $(expr $NEW / $OLD)% larger than default"
21+
else
22+
MSG="PR image is $(expr $OLD / $NEW)% smaller than default"
23+
fi
24+
curl -d '{"name":"Image size", "head_sha":"${{ github.sha }}", "conclusion":"neutral", "output":{"title":"'$MSG'", "summary":"foo"}}' \
1825
-H 'Content-Type: application/json' \
1926
-H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \
2027
-X POST https://api.github.com/repos/${{ github.repository }}/check-runs

0 commit comments

Comments
 (0)