From 4ad0fb2962a4f6ec32a488fe0e1eb2434a63ee75 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 3 Jul 2025 16:59:09 +0200 Subject: [PATCH] ci: add pages cleanup workflow --- .github/workflows/pages_cleanup.yml | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/pages_cleanup.yml diff --git a/.github/workflows/pages_cleanup.yml b/.github/workflows/pages_cleanup.yml new file mode 100644 index 000000000..66fb498a7 --- /dev/null +++ b/.github/workflows/pages_cleanup.yml @@ -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