doc-oc / .github /workflows /deploy.yml
Adityakeerti
Fix: skip LFS push when no model changes, disable HF locking
5aa6a5e
Raw History Blame Contribute Delete
1.18 kB
name: Sync to Hugging Face Hub
on:
push:
branches: [main]
workflow_dispatch:
jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Configure Git
run: |
git config --global user.name "github-actions"
git config --global user.email "actions@github.com"
- name: Push to Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git remote add hf https://oauth2:${HF_TOKEN}@huggingface.co/spaces/adityacodes404/doc-oc
# Disable unsupported LFS locking API on HF
git config lfs.https://huggingface.co/spaces/adityacodes404/doc-oc.git/info/lfs.locksverify false
# Only push LFS objects if model files changed in this commit
if git diff --name-only HEAD~1 HEAD 2>/dev/null | grep -q "^models/"; then
echo "Model files changed — pushing LFS objects..."
git lfs push hf --all
else
echo "No model changes — skipping LFS push."
fi
git push hf main --force