Skip to content

Commit f3e9fd9

Browse files
authored
Update doc preview cleanup CI job (#248)
1 parent 0f84999 commit f3e9fd9

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
name: Cleanup Doc Preview
1+
name: Doc Preview Cleanup
22

33
on:
44
pull_request:
55
types: [closed]
66

77
jobs:
8-
cleanup-doc-preview:
8+
doc-preview-cleanup:
99
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
1012
steps:
1113
- name: Checkout gh-pages branch
12-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1315
with:
1416
ref: gh-pages
15-
- name: Delete preview
17+
- name: Delete preview and history + push changes
1618
run: |
1719
if [ -d "previews/PR$PRNUM" ]; then
1820
git config user.name "Documenter.jl"
1921
git config user.email "[email protected]"
2022
git rm -rf "previews/PR$PRNUM"
21-
git commit -m "delete preview for $PRNUM"
22-
git push origin gh-pages:gh-pages
23+
git commit -m "delete preview"
24+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
25+
git push --force origin gh-pages-new:gh-pages
2326
fi
2427
env:
2528
PRNUM: ${{ github.event.number }}
2629

27-
# adapted from here:
30+
# copied from here:
2831
# https://juliadocs.github.io/Documenter.jl/stable/man/hosting/#gh-pages-Branch
29-
# without history cleanup

0 commit comments

Comments
 (0)