ci: add pages cleanup workflow

This commit is contained in:
Tim 2025-07-03 16:59:09 +02:00
parent b742e385ea
commit 4ad0fb2962

33
.github/workflows/pages_cleanup.yml vendored Normal file
View file

@ -0,0 +1,33 @@
name: GitHub Pages Cleanup
on:
push:
branches:
- gh-pages
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Delete directories older than 1 year
run: |
for dir in $(find . -mindepth 1 -maxdepth 2 -type d -not -path '*/\.*'); do
if ! git log -1 --since="1 year ago" -- "$dir" | grep -q .; then
echo "Deleting $dir"
rm -rf "$dir"
fi
done
- name: Commit and push
run: |
git config --global user.name 'GitHub Pages Cleanup'
git config --global user.email 'actions@stremio.com'
git add -A
git diff --cached --quiet || git commit -m "cleanup"
git push origin gh-pages