name: Sync Hugging Face Space on: push: branches: - main workflow_dispatch: jobs: sync-space: runs-on: ubuntu-latest permissions: contents: read steps: - name: Check out repository uses: actions/checkout@v6 with: fetch-depth: 0 lfs: true - name: Push main to Hugging Face Space env: HF_TOKEN: ${{ secrets.HF_TOKEN }} SPACE_REPO: shae2977/debugml-env run: | if [ -z "$HF_TOKEN" ]; then echo "GitHub Actions secret HF_TOKEN is not set." echo "Add a Hugging Face write token at: Settings > Secrets and variables > Actions" exit 1 fi git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git remote add space-sync "https://oauth2:${HF_TOKEN}@huggingface.co/spaces/${SPACE_REPO}" git push --force space-sync HEAD:main