Download .github/workflows/sync-to-hf.yml from Aluode/Life2: direct link, hf CLI and curl.
- Browser
- Download file 956 Bytes
-
https://huggingface.co/spaces/Aluode/Life2/resolve/main/.github/workflows/sync-to-hf.yml
- Command line
-
hf download hf://spaces/Aluode/Life2/.github/workflows/sync-to-hf.yml
-
curl -L -o sync-to-hf.yml https://huggingface.co/spaces/Aluode/Life2/resolve/main/.github/workflows/sync-to-hf.yml
956 Bytes
| # Mirrors this GitHub repo to the Hugging Face Space on every push to main. | |
| # One-time setup in the GitHub repo settings: | |
| # Secrets and variables -> Actions -> Secrets: HF_TOKEN = a Hugging Face token with write access | |
| # Secrets and variables -> Actions -> Variables: HF_SPACE = e.g. anttiluode/LifeAtHuggingface | |
| name: Sync to Hugging Face Space | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Push to the Space | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| HF_SPACE: ${{ vars.HF_SPACE }} | |
| run: | | |
| if [ -z "$HF_TOKEN" ] || [ -z "$HF_SPACE" ]; then | |
| echo "HF_TOKEN secret or HF_SPACE variable not set yet; nothing to sync." | |
| exit 0 | |
| fi | |
| git push --force "https://user:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE}" HEAD:main | |