From a042effacec62c57035ef01beeff7728610c183b Mon Sep 17 00:00:00 2001 From: Elias Carvalho Date: Tue, 23 Jun 2026 13:24:49 -0300 Subject: [PATCH 1/2] Update Doc Cleanup action to run monthly --- .github/workflows/DocCleanup.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/DocCleanup.yml b/.github/workflows/DocCleanup.yml index 612794f06..07ca4454a 100644 --- a/.github/workflows/DocCleanup.yml +++ b/.github/workflows/DocCleanup.yml @@ -1,24 +1,30 @@ name: Doc Cleanup on: - push: - branches: - - gh-pages + # runs on the 1st day of every month at 03:00 UTC + schedule: + - cron: '0 3 1 * *' workflow_dispatch: +permissions: + contents: write jobs: doc-cleanup: runs-on: ubuntu-latest steps: - name: Checkout gh-pages branch - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: ref: gh-pages - name: Delete old docs run: | - keep=$(readlink stable) + keep="$(readlink stable)" git config user.name "Documenter.jl" git config user.email "documenter@juliadocs.github.io" - git rm -rf v[0-9]*.[0-9]* && git checkout HEAD -- $keep - if git commit -m "keep latest docs only" ; then + git rm -rf --ignore-unmatch v[0-9]*.[0-9]* + git checkout HEAD -- "$keep" + if git diff --cached --quiet; then + echo "No old docs to delete" + else + git commit -m "Keep latest docs only" git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree}) git push --force origin gh-pages-new:gh-pages fi From 22a6576fd4cd07487d18a6db72bb8eae375558ab Mon Sep 17 00:00:00 2001 From: Elias Carvalho Date: Tue, 23 Jun 2026 16:55:42 -0300 Subject: [PATCH 2/2] Also delete previews --- .github/workflows/DocCleanup.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/DocCleanup.yml b/.github/workflows/DocCleanup.yml index 07ca4454a..463a5f599 100644 --- a/.github/workflows/DocCleanup.yml +++ b/.github/workflows/DocCleanup.yml @@ -19,12 +19,12 @@ jobs: keep="$(readlink stable)" git config user.name "Documenter.jl" git config user.email "documenter@juliadocs.github.io" - git rm -rf --ignore-unmatch v[0-9]*.[0-9]* + git rm -rf --ignore-unmatch "v[0-9]*.[0-9]*" "previews/*" git checkout HEAD -- "$keep" if git diff --cached --quiet; then - echo "No old docs to delete" + echo "No old docs or previews to delete" else - git commit -m "Keep latest docs only" + git commit -m "Delete old docs and previews" git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree}) git push --force origin gh-pages-new:gh-pages fi