Skip to content

Commit c4be684

Browse files
feat: add remove PR preview workflow (#118)
* feat: add remove PR preview workflow * fix: do not fail if not exist --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 44171bc commit c4be684

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Remove PR Preview
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
cleanup-preview:
9+
if: github.event.pull_request.merged == true
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout gh-pages branch
14+
uses: actions/checkout@v4
15+
with:
16+
ref: gh-pages
17+
persist-credentials: true
18+
19+
- name: Remove preview folder
20+
run: |
21+
rm -rf previews/${{ github.event.pull_request.number }} || true
22+
23+
- name: Commit and push changes
24+
run: |
25+
git config user.name "github-actions[bot]"
26+
git config user.email "github-actions[bot]@users.noreply.github.com"
27+
git add -A
28+
git commit -m "Remove preview for PR #${{ github.event.pull_request.number }}"
29+
git push

0 commit comments

Comments
 (0)