-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (31 loc) · 953 Bytes
/
PreviewCleanup.yml
File metadata and controls
35 lines (31 loc) · 953 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
32
33
34
35
name: Clean up PR preview
on:
pull_request:
types: [closed]
concurrency:
group: preview-cleanup-${{ github.event.pull_request.number }}
cancel-in-progress: false
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
contents: write # push the deletion to gh-pages
steps:
- name: Checkout gh-pages
uses: actions/checkout@v6
with:
ref: gh-pages
fetch-depth: 0
- name: Remove preview directory
env:
PR: ${{ github.event.pull_request.number }}
run: |
if [ -d "previews/PR${PR}" ]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git rm -rf "previews/PR${PR}"
git commit -m "Remove preview for PR #${PR}"
git push
else
echo "No preview directory for PR #${PR}, nothing to do."
fi