mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-01-11 22:40:31 +00:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
name: GitHub Pages Cleanup
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 0 * * 0'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
cleanup:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: gh-pages
|
|
fetch-depth: 0
|
|
|
|
- name: Delete directories that don't have existing branch
|
|
run: |
|
|
branches=( $(git branch -r | grep origin | grep -v HEAD | sed 's|origin/||') )
|
|
declare -p branches
|
|
|
|
find . -mindepth 1 -maxdepth 2 -type d -not -path '*/\.*' | while read -r dir; do
|
|
path="${dir#./}"
|
|
|
|
if [[ " ${branches[*]} " =~ " $path " ]]; then
|
|
continue
|
|
fi
|
|
|
|
keep_parent=false
|
|
for branch in "${branches[@]}"; do
|
|
if [[ "$branch" == "$path/"* ]]; then
|
|
keep_parent=true
|
|
break
|
|
fi
|
|
done
|
|
|
|
if ! $keep_parent; 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
|