Skip to content

Commit

Permalink
Update doc preview cleanup CI job (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored Nov 24, 2023
1 parent 0f84999 commit f3e9fd9
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
name: Cleanup Doc Preview
name: Doc Preview Cleanup

on:
pull_request:
types: [closed]

jobs:
cleanup-doc-preview:
doc-preview-cleanup:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Delete preview
- name: Delete preview and history + push changes
run: |
if [ -d "previews/PR$PRNUM" ]; then
git config user.name "Documenter.jl"
git config user.email "documenter@juliadocs.github.io"
git rm -rf "previews/PR$PRNUM"
git commit -m "delete preview for $PRNUM"
git push origin gh-pages:gh-pages
git commit -m "delete preview"
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
git push --force origin gh-pages-new:gh-pages
fi
env:
PRNUM: ${{ github.event.number }}

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

0 comments on commit f3e9fd9

Please sign in to comment.