2022-09-14 23:15:26 +08:00
|
|
|
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'
|
|
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
delete-old-spaces:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-02-02 02:14:41 +08:00
|
|
|
- uses: actions/checkout@v4
|
2022-09-14 23:15:26 +08:00
|
|
|
- name: Install Python
|
2023-12-08 04:15:36 +08:00
|
|
|
uses: actions/setup-python@v5
|
2022-09-14 23:15:26 +08:00
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
|
|
|
- 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'
|
|
|
|
run: echo "DAYS_STALE=${{ github.event.inputs.daysStale || env.DEFAULT_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 }}
|