fix(deps): bump @rollup/rollup-linux-x64-gnu from 4.18.1 to 4.19.0 #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Docker size' | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
permissions: | |
pull-requests: write | |
jobs: | |
calculate-base: | |
runs-on: ubuntu-latest | |
outputs: | |
image_size: ${{ steps.docker-base.outputs.image_size }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Get commit short hash | |
id: commit | |
run: | | |
short=$(git rev-parse --short HEAD) | |
echo "short=$short" >> "$GITHUB_OUTPUT" | |
- name: 📦 Cache docker image for commit ${{ steps.commit.outputs.short }} | |
uses: actions/cache@v4 | |
with: | |
path: base-docker-image.txt | |
key: base-docker-image-os-${{ runner.os }}-commit-${{ steps.commit.outputs.short }} | |
- name: 🐳 Calculate docker image size in ${{ github.base_ref }} | |
id: docker-base | |
run: | | |
if [ -f base-docker-image.txt ]; then | |
echo "Getting docker image from cache" | |
image_size=$(<base-docker-image.txt) | |
else | |
echo "Docker image not available in the cache" | |
docker build . -t service | |
image_size=$(docker images service | awk 'NR==2 {print $NF}') | |
fi | |
echo "$image_size" > base-docker-image.txt | |
echo "image_size=$image_size" >> "$GITHUB_OUTPUT" | |
calculate-head: | |
runs-on: ubuntu-latest | |
outputs: | |
image_size: ${{ steps.docker-head.outputs.image_size }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: 🐳 Calculate docker image size in ${{ github.head_ref }} | |
id: docker-head | |
run: | | |
docker build . -t service | |
image_size=$(docker images service | awk 'NR==2 {print $NF}') | |
echo "image_size=$image_size" >> "$GITHUB_OUTPUT" | |
write-comment: | |
runs-on: ubuntu-latest | |
needs: [calculate-base, calculate-head] | |
steps: | |
- uses: marocchino/sticky-pull-request-comment@v2 | |
env: | |
BASE_DOCKER_IMAGE_SIZE: ${{needs.calculate-base.outputs.image_size}} | |
HEAD_DOCKER_IMAGE_SIZE: ${{needs.calculate-head.outputs.image_size}} | |
with: | |
header: <docker-image-size> | |
message: | | |
## 🐳 Docker Metrics 🐳 | |
* Size of the Docker Image in the base (${{ github.base_ref }}): **${{ env.BASE_DOCKER_IMAGE_SIZE }}** | |
* Size of the Docker Image in this branch (${{ github.head_ref }}): **${{ env.HEAD_DOCKER_IMAGE_SIZE }}** |