name: Sync to Hugging Face Space on: push: branches: - main permissions: contents: write jobs: sync-to-space: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - name: Prepare Hugging Face README run: | # Temporarily replace README.md for Hugging Face mv README_hf.md README.md - name: Push to Hugging Face Space env: HF_TOKEN: ${{ secrets.HF_TOKEN }} HF_USERNAME: jatinmehra HF_SPACE: PDF-Insight-PRO run: | git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" git remote remove origin || true git remote add origin "https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE}" git add README.md git commit -m "Update Hugging Face README" || true git push origin main || (git branch -M main && git push -f origin main)