Skip to content

Commit d4921b2

Browse files
committed
ci: don't fail cleanup if nothing is stale
1 parent d6ef268 commit d4921b2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/ghpages-cleanup.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,20 @@ jobs:
2121
run: |
2222
for dir in */; do
2323
if [ -z "$(git log -n 1 --since "1 month ago" -- "$dir")" ]; then
24-
git rm -r "$dir"
24+
echo "Removing stale directory: $dir"
25+
git rm --quiet -r "$dir"
2526
fi
2627
done
27-
git status
28-
- name: Commit
28+
- name: Configure git user
2929
run: |
3030
git config user.name 'github-actions[bot]'
3131
git config user.email 'github-actions[bot]@users.noreply.github.com'
32-
git commit -m 'chore: remove stale GitHub Pages branches'
32+
- name: Commit
33+
run: |
34+
if diff --staged --quiet; then
35+
echo 'No stale directories were found. Nothing to commit.'
36+
else
37+
git commit -m 'chore: remove stale GitHub Pages branches'
38+
fi
3339
- name: Push
3440
run: "git push"

0 commit comments

Comments
 (0)