-
Notifications
You must be signed in to change notification settings - Fork 2.7k
42 lines (38 loc) · 1.11 KB
/
delete-stale-spaces.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
# safe runs from main
name: Delete Stale Spaces
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
inputs:
daysStale:
description: "How stale a space needs to be to be deleted (days)"
required: true
default: "7"
permissions: {}
jobs:
delete-old-spaces:
permissions:
contents: read
environment: deploy_spaces
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install pip
run: python -m pip install pip wheel requests
- name: Install Hub Client Library
run: pip install huggingface-hub==0.9.1
- name: Set daysStale
env:
DEFAULT_DAYS_STALE: "7"
DAYS_STALE: ${{ github.event.inputs.daysStale || env.DEFAULT_DAYS_STALE}}
run: echo DAYS_STALE= "$DAYS_STALE" >> $GITHUB_ENV
- name: Find and delete stale spaces
run: |
python scripts/delete_old_spaces.py $DAYS_STALE \
gradio-pr-deploys \
${{ secrets.SPACES_DEPLOY_TOKEN }}