name: Sync to Hugging Face Space on: push: branches: [ main ] jobs: deploy-to-hf-space: runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v3 - name: Install Git run: sudo apt-get install git - name: Push to Hugging Face Space env: HF_TOKEN: ${{ secrets.HF_TOKEN }} HF_USERNAME: ${{ secrets.HF_USERNAME }} EMAIL: ${{ secrets.EMAIL }} run: | git config --global user.email $EMAIL git config --global user.name $HF_USERNAME git clone https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/ObjectDetection hf_space rsync -av --exclude='.git' ./ hf_space/ cd hf_space git add . if git diff --cached --quiet; then echo "✅ No changes to commit." else git commit -m "Sync from GitHub" git push fi