Skip to content

Commit 6def768

Browse files
authored
Merge pull request #1943 from Saransh-cpp/clean-gh-pages
Add a workflow to delete PR previews
2 parents f038cff + 5a0a114 commit 6def768

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/clean_preview.yml

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

0 commit comments

Comments
 (0)