-
Notifications
You must be signed in to change notification settings - Fork 15
33 lines (29 loc) · 948 Bytes
/
cleanup-pr-docs.yml
File metadata and controls
33 lines (29 loc) · 948 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
name: Cleanup PR Documentation
on:
pull_request:
types: [closed]
workflow_dispatch:
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
repository: TorchJD/documentation
ref: main
ssh-key: ${{ secrets.DOCUMENTATION_DEPLOY_KEY }}
- name: Remove PR documentation for closed PR
run: |
PR_NUMBER="${{ github.event.number }}"
echo "Removing documentation for PR #${PR_NUMBER}"
rm -rf pr/${PR_NUMBER}
- name: Commit and push cleanup
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add .
git commit -m "Cleanup documentation for closed PR #${{ github.event.number }}" || echo "No changes to commit"
git push origin HEAD:main