Skip to content

Commit 4b31377

Browse files
committed
ci: clean up stale GH Pages subdirectories
1 parent d19570d commit 4b31377

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
on:
2+
schedule:
3+
- cron: 0 0 * * 6 # midnight on Saturdays
4+
workflow_dispatch:
5+
6+
jobs:
7+
cleanup:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Check out GH Pages branch
11+
uses: actions/checkout
12+
with:
13+
# replace `fetch-depth` with `shallow-since` if and when actions/checkout#619 (or an equivalent) gets merged
14+
fetch-depth: 0
15+
ref: gh-pages
16+
- name: Mark stale directories for removal
17+
run: |
18+
for dir in */; do
19+
if [ -z "$(git log -n 1 --since "1 month ago" -- "$dir")" ]; then
20+
git rm -r "$dir"
21+
fi
22+
done
23+
git status
24+
- name: Commit
25+
run: "git commit -m 'chore: remove stale GH Pages branches'"
26+
- name: Push
27+
run: "git push"

0 commit comments

Comments
 (0)