-
Notifications
You must be signed in to change notification settings - Fork 3
68 lines (61 loc) · 1.95 KB
/
auto-cleaner.yml
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Auto cleaner
on:
pull_request:
types:
- opened
- synchronize
- reopened
- closed
branches:
- main
paths:
- ".github/auto-cleaner.js"
- ".github/workflows/auto-cleaner.yml"
schedule:
- cron: "0 0 */3 * *"
env:
NODE_VERSION: 20.x
jobs:
clean-builds:
if: github.event.action != 'closed' || (github.event.action == 'closed' && github.event.pull_request.merged)
runs-on: ubuntu-latest
steps:
- name: Install required tools
run: |
sudo apt-get update -y
sudo apt-get install -y jq wget curl unzip
sudo -v ; curl https://rclone.org/install.sh | sudo bash
- name: Check out repository
uses: actions/checkout@v4
- name: Use Node.js ${{env.NODE_VERSION}}
uses: actions/setup-node@v4
with:
node-version: ${{env.NODE_VERSION}}
- name: Cleanup
if: github.event_name == 'schedule'
run: |
cat << EOF > /tmp/rclone.conf
$RCLONE_CONFIG
EOF
echo
node ${{github.workspace}}/.github/auto-cleaner.js
env:
API_TOKEN: ${{secrets.HOMELAB_LXC_TOKEN}}
API_ENDPOINT: ${{secrets.HOMELAB_LXC_EP}}
RCLONE_CONFIG: ${{secrets.RCLONE_CONFIG}}
RCLONE_CONFIG_PASS: ${{secrets.RCLONE_CONFIG_PASS}}
MAX_BUILDS: 1
- name: Cleanup Test
if: github.event.action == 'opened' || github.event.action == 'reopened' || (github.event.action == 'closed' && github.event.pull_request.merged)
run: |
cat << EOF > /tmp/rclone.conf
$RCLONE_CONFIG
EOF
echo
node ${{github.workspace}}/.github/auto-cleaner.js
env:
API_TOKEN: ${{secrets.HOMELAB_LXC_TOKEN}}
API_ENDPOINT: ${{secrets.HOMELAB_LXC_EP}}
RCLONE_CONFIG: ${{secrets.RCLONE_CONFIG}}
RCLONE_CONFIG_PASS: ${{secrets.RCLONE_CONFIG_PASS}}
MAX_BUILDS: 10