name: Sync to Hugging Face Hub on: push: branches: [main] jobs: sync-to-hub: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 # Full history required lfs: true - name: Configure Git run: | git config --global user.email "actions@github.com" git config --global user.name "GitHub Actions" - name: Force push clean history to HF Space env: HF_TOKEN: ${{ secrets.HF_TOKEN }} HF_SPACE_ID: ${{ vars.HF_SPACE_ID }} run: | git remote add hf https://huggingface.co/spaces/${{ secrets.HF_SPACE_ID }} git push https://huggingface_hub:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/${{ secrets.HF_SPACE_ID }} HEAD:main --force