-
Notifications
You must be signed in to change notification settings - Fork 170
45 lines (36 loc) · 967 Bytes
/
cleanup.yaml
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
36
37
38
39
40
41
# Run tests using the beta Rust compiler
name: Cleanup
on:
schedule:
# 06:50 UTC every Monday
- cron: '50 6 * * 1'
workflow_dispatch:
concurrency:
group: beta-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
IROH_FORCE_STAGING_RELAYS: "1"
jobs:
clean_docs_branch:
permissions:
issues: write
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: generated-docs-preview
- name: Clean docs branch
run: |
cd pr/
# keep the last 25 prs
dirs=$(ls -1d [0-9]* | sort -n)
total_dirs=$(echo "$dirs" | wc -l)
dirs_to_remove=$(echo "$dirs" | head -n $(($total_dirs - 25)))
if [ -n "$dirs_to_remove" ]; then
echo "$dirs_to_remove" | xargs rm -rf
fi
git add .
git commit -m "Cleanup old docs"
git push