Spaces:
Sleeping
Sleeping
Abhijeet Mahapatra commited on
Commit ·
5eaf9ff
1
Parent(s): fd40a0a
Fix HF sync: push LFS objects to HF before git push
Browse files
.github/workflows/hf_sync.yml
CHANGED
|
@@ -2,7 +2,7 @@ name: Sync to Hugging Face Org Hub
|
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
-
branches: [main]
|
| 6 |
|
| 7 |
workflow_dispatch:
|
| 8 |
|
|
@@ -14,11 +14,26 @@ jobs:
|
|
| 14 |
uses: actions/checkout@v4
|
| 15 |
with:
|
| 16 |
fetch-depth: 0
|
| 17 |
-
lfs: true
|
| 18 |
|
| 19 |
-
- name:
|
| 20 |
env:
|
| 21 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 22 |
run: |
|
| 23 |
-
git config
|
| 24 |
-
git
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
+
branches: [main]
|
| 6 |
|
| 7 |
workflow_dispatch:
|
| 8 |
|
|
|
|
| 14 |
uses: actions/checkout@v4
|
| 15 |
with:
|
| 16 |
fetch-depth: 0
|
| 17 |
+
lfs: true
|
| 18 |
|
| 19 |
+
- name: Configure Git LFS for Hugging Face and push LFS objects
|
| 20 |
env:
|
| 21 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 22 |
run: |
|
| 23 |
+
git config --global user.email "github-actions@github.com"
|
| 24 |
+
git config --global user.name "GitHub Actions"
|
| 25 |
+
|
| 26 |
+
# Add HF remote
|
| 27 |
+
git remote add hf https://smolhuman:$HF_TOKEN@huggingface.co/spaces/build-small-hackathon/Noisy_News
|
| 28 |
+
|
| 29 |
+
# Fetch all LFS objects from GitHub origin
|
| 30 |
+
git lfs fetch --all origin
|
| 31 |
+
|
| 32 |
+
# Push LFS objects to Hugging Face LFS storage first
|
| 33 |
+
git lfs push --all hf
|
| 34 |
+
|
| 35 |
+
- name: Push commits to Hugging Face Space
|
| 36 |
+
env:
|
| 37 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 38 |
+
run: |
|
| 39 |
+
git push --force hf HEAD:main
|