name: Weekly Cache Purge

on:
  schedule:
    - cron: '0 0 * * 0' # Every Sunday at 00:00
  workflow_dispatch:

jobs:
  purge-cache:
    if: github.repository == 'sgl-project/sglang'
    runs-on: self-hosted

    steps:
    - name: Checkout code
      uses: actions/checkout@v3

    - name: Purge pip cache
      run: |
        source $HOME/venv/bin/activate
        echo "$HOME/venv/bin" >> $GITHUB_PATH
        pip cache purge

    - name: Update dependencies
      run: |
        pip install --upgrade pip
        pip install -e "python[all]"
        pip install flashinfer -i https://flashinfer.ai/whl/cu121/torch2.4/ --force-reinstall
