File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Docs Preview Cleanup
2+
3+ on :
4+ pull_request :
5+ types :
6+ - closed
7+
8+ permissions :
9+ contents : write
10+
11+ jobs :
12+ cleanup :
13+ name : Cleanup documentation preview
14+ runs-on : ubuntu-latest
15+ steps :
16+ - uses : actions/checkout@v6
17+ with :
18+ ref : gh-pages
19+ fetch-depth : 0
20+
21+ - name : Remove documentation preview
22+ run : |
23+ target="previews/PR${{ github.event.pull_request.number }}"
24+ if [ -d "$target" ]; then
25+ rm -rf "$target"
26+ git config user.name "github-actions[bot]"
27+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
28+ git add -A
29+ git commit -m "Remove preview for PR #${{ github.event.pull_request.number }} [skip ci]"
30+ git push origin HEAD:gh-pages
31+ else
32+ echo "No preview directory to clean."
33+ fi
Original file line number Diff line number Diff line change 11name : Docs Preview
22
33on :
4- pull_request :
5- types :
6- - closed
74 workflow_run :
85 workflows :
96 - CI
107 types :
118 - completed
9+ branches-ignore :
10+ - master
1211
1312permissions :
14- actions : read
15- contents : write
1613 issues : write
1714 pull-requests : read
1815
1916jobs :
2017 comment :
2118 if : >-
22- github.event_name == 'workflow_run' &&
2319 github.event.workflow_run.event == 'pull_request' &&
2420 github.event.workflow_run.conclusion == 'success'
2521 name : Comment documentation preview URL
8682 body,
8783 });
8884 }
89-
90- cleanup :
91- if : github.event_name == 'pull_request' && github.event.action == 'closed'
92- name : Cleanup documentation preview
93- runs-on : ubuntu-latest
94- steps :
95- - uses : actions/checkout@v6
96- with :
97- ref : gh-pages
98- fetch-depth : 0
99-
100- - name : Remove documentation preview
101- run : |
102- target="previews/PR${{ github.event.pull_request.number }}"
103- if [ -d "$target" ]; then
104- rm -rf "$target"
105- git config user.name "github-actions[bot]"
106- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
107- git add -A
108- git commit -m "Remove preview for PR #${{ github.event.pull_request.number }} [skip ci]"
109- git push origin HEAD:gh-pages
110- else
111- echo "No preview directory to clean."
112- fi
You can’t perform that action at this time.
0 commit comments