refactor: Update factory_restart_space.py to use environment variable for Hugging Face API token

This commit is contained in:
ogabrielluiz 2024-06-03 09:54:47 -03:00
commit 5fe568cc6c

View file

@ -54,10 +54,28 @@ jobs:
tags: ${{ env.TAGS }}
- name: Wait for Docker Hub to propagate
run: sleep 120
- name: Restart HuggingFace Spaces Build
# There's a script in ./scripts/factory_reset_space.py that will reset the build
# using the HUGGINGFACE_API_TOKEN secret
restart-space:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_caching"
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.POETRY_VERSION }}
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Python dependencies
run: |
python ./scripts/factory_restart_space.py
poetry env use ${{ matrix.python-version }}
poetry install
- name: Restart HuggingFace Spaces Build
run: |
poetry run python ./scripts/factory_restart_space.py
env:
HUGGINGFACE_API_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }}