Skip to content

Commit

Permalink
refactor: Update factory_restart_space.py to use environment variable…
Browse files Browse the repository at this point in the history
… for Hugging Face API token
  • Loading branch information
ogabrielluiz committed Jun 3, 2024
1 parent aafaa16 commit 5fe568c
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,28 @@ jobs:
tags: ${{ env.TAGS }}
- name: Wait for Docker Hub to propagate
run: sleep 120

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: |
poetry env use ${{ matrix.python-version }}
poetry install
- 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
run: |
python ./scripts/factory_restart_space.py
poetry run python ./scripts/factory_restart_space.py
env:
HUGGINGFACE_API_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }}

0 comments on commit 5fe568c

Please sign in to comment.