Skip to content

Commit 1eb9843

Browse files
authored
[CI] Do not error out when cleaning up docs if previews don't exist (#78)
1 parent ab04f73 commit 1eb9843

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

.github/workflows/DocPreviewsCleanup.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ jobs:
2525
ref: gh-pages
2626
- name: Delete preview and history + push changes
2727
run: |
28-
git config user.name "Documenter.jl"
29-
git config user.email "[email protected]"
30-
git rm -rf previews/*
31-
git commit -m "delete previews directory"
32-
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
33-
git push --force origin gh-pages-new:gh-pages
28+
preview_directory=previews/PR${{ github.event.number }}
29+
if [[ -d "${preview_directory}" ]]; then
30+
git config user.name "${{github.actor}}"
31+
git config user.email "${{github.actor_id}}+${{github.actor}}@users.noreply.github.com"
32+
git rm -rf "${preview_directory}"
33+
git commit -m 'Cleanup docs for PR #${{ github.event.number }}'
34+
git branch gh-pages-new $(echo "Delete history" | git commit-tree HEAD^{tree})
35+
git push --force origin gh-pages-new:gh-pages
36+
fi

0 commit comments

Comments
 (0)