mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
ci: add pages cleanup workflow
This commit is contained in:
parent
b742e385ea
commit
4ad0fb2962
1 changed files with 33 additions and 0 deletions
33
.github/workflows/pages_cleanup.yml
vendored
Normal file
33
.github/workflows/pages_cleanup.yml
vendored
Normal 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
|
||||
Loading…
Reference in a new issue