-
Notifications
You must be signed in to change notification settings - Fork 7
32 lines (29 loc) · 1010 Bytes
/
DocPreviewsCleanup.yml
File metadata and controls
32 lines (29 loc) · 1010 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
name: Doc Previews Cleanup
on:
schedule:
- cron: "25 22 * * 2"
workflow_dispatch:
concurrency:
# Same group concurrency as the `Documentation.yml` workflow, because they both
# git-push to the same branch, so we want to avoid clashes.
group: docs-pushing
jobs:
doc-preview-cleanup:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v6
with:
ref: gh-pages
- name: Delete preview and history + push changes
run: |
if [[ -d previews ]]; then
git config user.name "${{github.actor}}"
git config user.email "${{github.actor_id}}+${{github.actor}}@users.noreply.github.com"
git rm -rf previews/
git commit -m 'Delete previews directory'
git branch gh-pages-new $(echo "Delete history" | git commit-tree HEAD^{tree})
git push --force-with-lease origin gh-pages-new:gh-pages
fi