From 2c71920c55bbbce5078a24e93fd6d3d72b285ac2 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 30 Oct 2026 18:22:29 +0100 Subject: [PATCH] ci(size): comment the size change on pull requests --- .github/workflows/actions.lock | 1 + .github/workflows/pull-request.yaml | 35 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index 0de0334bcc..bee3f3ffcb 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -26,6 +26,7 @@ workflows: '.github/workflows/pr-quality.yaml': - 'peakoss/anti-slop@v0.3.0' '.github/workflows/pull-request.yaml': + - 'actions/checkout@v7.0.1' - 'actions/download-artifact@v8.0.2' - 'docker/login-action@v4.7.0' '.github/workflows/release.yaml': diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 42a585f23d..a5c13b5ed1 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -82,3 +82,38 @@ jobs: sources+=("oci-layout://${index%/index.json}@$(jq -r '.manifests[0].digest' "$index")") done docker buildx imagetools create --tag "ghcr.io/coollabsio/coolify:$TAG" "${sources[@]}" + + size: + name: Compare size with latest + needs: build + permissions: + contents: read + pull-requests: write # comment the size report on the pull request + runs-on: ubuntu-26.04 # https://github.com/actions/runner-images + timeout-minutes: 30 + steps: + - name: Check out the repository + uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + + - name: Download the built images + uses: actions/download-artifact@v8.0.2 + with: + pattern: image-* + path: ${{ runner.temp }}/images + + - name: Compare the size with the latest release + env: + IMAGE_NAME: pr-${{ github.event.pull_request.number }} + OUTPUT_FILE: ${{ runner.temp }}/size.md + run: | + scripts/size.sh "$RUNNER_TEMP/images" coollabsio/coolify:latest + cat "$OUTPUT_FILE" >> "$GITHUB_STEP_SUMMARY" + + - name: Comment the size on the pull request + if: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} + env: + GH_TOKEN: ${{ github.token }} + PULL_REQUEST: ${{ github.event.pull_request.number }} + run: gh pr comment "$PULL_REQUEST" --body-file "$RUNNER_TEMP/size.md" --edit-last --create-if-none