Skip to content

Commit e2d5add

Browse files
committed
docs: adjust script to handle zero unused images DOC-1232
1 parent 03ca0c4 commit e2d5add

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

.github/workflows/clean-up-unused-images.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
# On the first of every month at 2 am
66
- cron: '0 2 1 * *'
77
workflow_dispatch:
8+
push:
9+
branches: ['handle-zero-images-doc-1232']
810

911
concurrency:
1012
group: clean-up-images-${{ github.ref }}
@@ -49,10 +51,16 @@ jobs:
4951
5052
- name: Create PR with unused images
5153
run: |
52-
unused_image_count=$(wc -l < unused_images.json)
53-
if unused_image_count == 0; then
54-
"No images found to remove."
55-
exit 0
54+
file="unused_images.json"
55+
if [[ -f "$file" ]]; then
56+
unused_image_count=$(wc -l < "$file")
57+
if [ "$unused_image_count" -eq 0 ]; then
58+
echo "No images found to remove."
59+
exit 0
60+
fi
61+
else
62+
echo "File $file not found."
63+
exit 1
5664
fi
5765
5866
# Ensure that we are on master.

0 commit comments

Comments
 (0)