-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (27 loc) · 879 Bytes
/
Copy pathpreview-cleanup.yml
File metadata and controls
31 lines (27 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: PR Preview Cleanup
on:
pull_request:
types: [closed]
permissions:
contents: write
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: gh-pages
- name: Remove PR preview directory
run: |
PR_DIR="previews/pr-${{ github.event.number }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if [ -d "$PR_DIR" ]; then
git rm -rf "$PR_DIR"
git commit -m "chore: remove preview for PR #${{ github.event.number }}"
git push
echo "Removed $PR_DIR"
else
echo "No preview directory found at $PR_DIR — nothing to clean up"
fi