Skip to content

Commit b20d099

Browse files
authored
Add doc_cleanup.yml GitHub action (#629)
1 parent bb17c4c commit b20d099

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/doc_cleanup.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Doc Preview Cleanup
2+
on:
3+
pull_request:
4+
types: [closed]
5+
jobs:
6+
doc-preview-cleanup:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout gh-pages branch
10+
uses: actions/checkout@v4
11+
with:
12+
ref: gh-pages
13+
- name: Delete preview and history + push changes
14+
run: |
15+
if [ -d "previews/PR$PRNUM" ]; then
16+
git config user.name "Documenter.jl"
17+
git config user.email "[email protected]"
18+
git rm -rf "previews/PR$PRNUM"
19+
git commit -m "delete preview"
20+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
21+
git push --force origin gh-pages-new:gh-pages
22+
fi
23+
env:
24+
PRNUM: ${{ github.event.number }}

0 commit comments

Comments
 (0)