Skip to content

Commit

Permalink
docs: adjust script to handle zero unused images DOC-1232
Browse files Browse the repository at this point in the history
  • Loading branch information
addetz committed Oct 24, 2024
1 parent 03ca0c4 commit 4ec8d3e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/clean-up-unused-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
# On the first of every month at 2 am
- cron: '0 2 1 * *'
workflow_dispatch:
push:
branches: ['handle-zero-images-doc-1232']

concurrency:
group: clean-up-images-${{ github.ref }}
Expand Down Expand Up @@ -49,10 +51,16 @@ jobs:
- name: Create PR with unused images
run: |
unused_image_count=$(wc -l < unused_images.json)
if unused_image_count == 0; then
"No images found to remove."
exit 0
file="unused_images.json"
if [[ -f "$file" ]]; then
unused_image_count=$(wc -l < "$file")
if $unused_image_count == 0; then
"No images found to remove."
exit 0
fi
else
echo "File $file not found."
exit 1
fi
# Ensure that we are on master.
Expand Down

0 comments on commit 4ec8d3e

Please sign in to comment.