Skip to content

Commit 36e49a4

Browse files
committed
test2
Signed-off-by: ZePan110 <ze.pan@intel.com>
1 parent d235f6e commit 36e49a4

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

.github/workflows/pr-image-size.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ jobs:
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

0 commit comments

Comments
 (0)