Skip to content

Commit 8efb071

Browse files
authored
skip when nothing to clean (#465)
Co-authored-by: Christopher Doris <github.com/cjdoris>
1 parent 0d96c68 commit 8efb071

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

.github/workflows/docscleanup.yml

+9-10
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ jobs:
1515

1616
- name: Delete preview and history
1717
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})
18+
if [ -d "$DIR" ]; then
19+
git config user.name "Documenter.jl"
20+
git config user.email "[email protected]"
21+
git rm -rf "$DIR"
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
2326
env:
24-
PRNUM: ${{ github.event.number }}
27+
DIR: "previews/PR${{ github.event.number }}"
2528

26-
- name: Push changes
27-
run: |
28-
git push --force origin gh-pages-new:gh-pages
29-
3029
# Workflow copied from https://github.com/CliMA/TimeMachine.jl

0 commit comments

Comments
 (0)