Skip to content

Commit d99e295

Browse files
astandrikAnton Standrik
and
Anton Standrik
authored
fix: delete directory from gh-pages on pr close (#1638)
Co-authored-by: Anton Standrik <[email protected]>
1 parent c71925d commit d99e295

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Cleanup GitHub Pages on PR Close
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
8+
jobs:
9+
cleanup:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pages: write
14+
pull-requests: write
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Fetch gh-pages branch
20+
run: |
21+
git fetch origin gh-pages:gh-pages
22+
mkdir gh-pages
23+
git --work-tree=gh-pages checkout gh-pages -- .
24+
25+
- name: Remove PR directory
26+
run: |
27+
rm -rf gh-pages/${{ github.event.pull_request.number }}
28+
29+
- name: Deploy report to GitHub Pages
30+
uses: peaceiris/actions-gh-pages@v3
31+
with:
32+
github_token: ${{ secrets.GITHUB_TOKEN }}
33+
publish_dir: gh-pages
34+
destination_dir: .
35+
force_orphan: true

0 commit comments

Comments
 (0)