File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737 git fetch origin ${{ github.base_ref }}
3838 merged_commit=$(git log -1 --format='%H')
3939 files=$(git diff --name-status --diff-filter=ARM ${{ github.event.pull_request.base.sha }} ${merged_commit} | awk '{print $2}' | grep -E 'Dockerfile$' || true)
40- echo "changed_files=$files"
41- echo "files<<EOF" >> $GITHUB_OUTPUT
42- echo "$files" >> $GITHUB_OUTPUT
43- echo "EOF" >> $GITHUB_OUTPUT
40+ echo "change_files=$files" >> $GITHUB_OUTPUT
4441
4542 - name : Build and check image sizes
4643 if : steps.changed-dockerfiles.outputs.files != ''
@@ -54,12 +51,12 @@ jobs:
5451 image_pr="pr-image-size-pr:$(echo $dir | tr '/' '-')"
5552 cd $dir
5653 echo "Building base image for $dockerfile"
57- git checkout origin/${{ github.base_ref }} -- "$dockerfile"
54+ git switch origin/${{ github.base_ref }}
5855 docker build -f "$dockerfile" -t "$image_base" --no-cache .
5956 size_base=$(docker image inspect "$image_base" | jq '.[0].Size / (1024 * 1024) | round')
6057
6158 echo "Building PR image for $dockerfile"
62- git checkout -- "$dockerfile" # restore PR version
59+ git checkout ${{ github.event.pull_request.base.sha }}
6360 docker build -f "$dockerfile" -t "$image_pr" --no-cache .
6461 size_pr=$(docker image inspect "$image_pr" | jq '.[0].Size / (1024 * 1024) | round')
6562
You can’t perform that action at this time.
0 commit comments