Skip to content

Doc Previews Cleanup #1

Doc Previews Cleanup

Doc Previews Cleanup #1

name: Doc Previews Cleanup
on:
schedule:
- cron: "25 22 * * 2"
workflow_dispatch:
concurrency:
# Same group concurrency as the `Documentation.yml` workflow, because they both
# git-push to the same branch, so we want to avoid clashes.
group: docs-pushing
jobs:
doc-preview-cleanup:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v6
with:
ref: gh-pages
- name: Delete preview and history + push changes
run: |
if [[ -d previews ]]; then
git config user.name "${{github.actor}}"
git config user.email "${{github.actor_id}}+${{github.actor}}@users.noreply.github.com"
git rm -rf previews/
git commit -m 'Delete previews directory'
git branch gh-pages-new $(echo "Delete history" | git commit-tree HEAD^{tree})
git push --force-with-lease origin gh-pages-new:gh-pages
fi