Skip to content

Commit 33bd367

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

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ 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"
4140
echo "files<<EOF" >> $GITHUB_OUTPUT
4241
echo "$files" >> $GITHUB_OUTPUT
4342
echo "EOF" >> $GITHUB_OUTPUT
@@ -50,17 +49,20 @@ jobs:
5049
while read -r dockerfile; do
5150
[ -z "$dockerfile" ] && continue
5251
dir=$(dirname "$dockerfile")
52+
file=$(basename "$dockerfile")
5353
image_base="pr-image-size-base:$(echo $dir | tr '/' '-')"
5454
image_pr="pr-image-size-pr:$(echo $dir | tr '/' '-')"
5555
cd $dir
5656
echo "Building base image for $dockerfile"
57-
git checkout origin/${{ github.base_ref }} -- "$dockerfile"
58-
docker build -f "$dockerfile" -t "$image_base" --no-cache .
57+
git checkout origin/${{ github.base_ref }}
58+
docker build -f "$file" -t "$image_base" --no-cache .
59+
cat $file
5960
size_base=$(docker image inspect "$image_base" | jq '.[0].Size / (1024 * 1024) | round')
6061
6162
echo "Building PR image for $dockerfile"
62-
git checkout -- "$dockerfile" # restore PR version
63-
docker build -f "$dockerfile" -t "$image_pr" --no-cache .
63+
git checkout ${{ github.event.pull_request.base.sha }}
64+
docker build -f "$file" -t "$image_pr" --no-cache .
65+
cat $file
6466
size_pr=$(docker image inspect "$image_pr" | jq '.[0].Size / (1024 * 1024) | round')
6567
6668
diff=$((size_pr - size_base))

0 commit comments

Comments
 (0)