Skip to content

Commit ae78b73

Browse files
authored
Avoid failures when cleaning docs (#262)
1 parent 0867f29 commit ae78b73

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

.github/workflows/doc_preview_cleanup.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@ jobs:
1212
uses: actions/checkout@v2
1313
with:
1414
ref: gh-pages
15-
16-
- name: Delete preview and history
15+
- name: Delete preview and history + push changes
1716
run: |
18-
git config user.name "Documenter.jl"
19-
git config user.email "[email protected]"
20-
git rm -rf "previews/PR$PRNUM"
21-
git commit -m "delete preview"
22-
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
17+
if [ -d "previews/PR$PRNUM" ]; then
18+
git config user.name "Documenter.jl"
19+
git config user.email "[email protected]"
20+
git rm -rf "previews/PR$PRNUM"
21+
git commit -m "delete preview"
22+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
23+
git push --force origin gh-pages-new:gh-pages
24+
fi
2325
env:
2426
PRNUM: ${{ github.event.number }}
25-
26-
- name: Push changes
27-
run: |
28-
git push --force origin gh-pages-new:gh-pages

0 commit comments

Comments
 (0)