Skip to content

Commit 2523bf5

Browse files
Cleanup old Documentation previews (#295)
1 parent 36a254c commit 2523bf5

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Documentation Preview Cleanup
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
# Ensure that only one "Documentation Preview Cleanup" workflow is force pushing at a time
7+
concurrency:
8+
group: doc-preview-cleanup
9+
cancel-in-progress: false
10+
11+
jobs:
12+
doc-preview-cleanup:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- name: Checkout gh-pages branch
18+
uses: actions/checkout@v6
19+
with:
20+
ref: gh-pages
21+
- name: Delete preview and history + push changes
22+
run: |
23+
if [ -d "${preview_dir}" ]; then
24+
git config user.name "Documenter.jl"
25+
git config user.email "documenter@juliadocs.github.io"
26+
git rm -rf "${preview_dir}"
27+
git commit -m "delete preview"
28+
git branch gh-pages-new "$(echo "delete history" | git commit-tree "HEAD^{tree}")"
29+
git push --force origin gh-pages-new:gh-pages
30+
fi
31+
env:
32+
preview_dir: previews/PR${{ github.event.number }}

0 commit comments

Comments
 (0)