name: Sync to Hugging Face hub on: push: branches: ["master"] permissions: contents: write pull-requests: write jobs: sync-to-hub: runs-on: ubuntu-latest environment: HF_TOKEN steps: - name: Harden the runner (Audit all outbound calls) uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 with: egress-policy: audit - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 lfs: true - name: Configure Git run: | git config --global user.email "action@github.com" git config --global user.name "github-actions" - name: Push to Hugging Face Hub env: HF_TOKEN: ${{ secrets.HF_TOKEN }} HF_USERNAME: ${{ github.repository_owner }} HF_SPACE: ${{ github.repository }} HF_BRANCH: main run: | git remote set-url origin https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_SPACE git push origin master:$HF_BRANCH --force