Skip to content

Commit 0fcec1b

Browse files
committed
Test comment
Signed-off-by: ZePan110 <ze.pan@intel.com>
1 parent 686d950 commit 0fcec1b

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ jobs:
4343
- name: Build and check image sizes
4444
if: steps.changed-dockerfiles.outputs.files != ''
4545
run: |
46-
set -e
46+
set -x
4747
merged_commit=$(git log -1 --format='%H')
48-
echo "### Images size variations" >> $GITHUB_STEP_SUMMARY
4948
while IFS= read -r -d '' dockerfile; do
5049
[ -z "$dockerfile" ] && continue
5150
dir=$(dirname "$dockerfile")
@@ -73,7 +72,22 @@ jobs:
7372
size_pr=$(docker image inspect "$image_pr" | jq '.[0].Size / (1024 * 1024) | round')
7473
7574
diff=$((size_pr - size_base))
76-
echo "::warning::Image size change: $size_base -> $size_pr MB' (diff: $diff MB)"
77-
echo "File $dockerfile resulted in a change in the image size from $size_base -> $size_pr MB" >> $GITHUB_STEP_SUMMARY
75+
# echo "::warning::Image size change: $size_base -> $size_pr MB' (diff: $diff MB)"
76+
echo "comment to ${{ github.event.pull_request.number }}"
77+
if [ "$diff" -gt 50 ]; then
78+
curl -X POST \
79+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
80+
-H "Accept: application/vnd.github.v3+json" \
81+
"https://github.com/opea-project/GenAIExamples/issues/${{ github.event.pull_request.number }}/comments" \
82+
-d '{"body":"⚠️ File $dockerfile resulted in a change in the image size from $size_base -> $size_pr MB"}'
83+
else
84+
curl -X POST \
85+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
86+
-H "Accept: application/vnd.github.v3+json" \
87+
"https://github.com/opea-project/GenAIExamples/issues/${{ github.event.pull_request.number }}/comments" \
88+
-d '{"body":"File $dockerfile resulted in a change in the image size from $size_base -> $size_pr MB"}'
89+
fi
90+
91+
# echo "File $dockerfile resulted in a change in the image size from $size_base -> $size_pr MB" >> $GITHUB_STEP_SUMMARY
7892
docker rmi "$image_base" "$image_pr"
7993
done < <(echo "${{ steps.changed-dockerfiles.outputs.files }}" | tr '\n' '\0')

0 commit comments

Comments
 (0)