DZRobo commited on
Commit
e109c36
·
1 Parent(s): 695fbf0

Add Git LFS support to HF mirror workflow

Browse files

Enabled Git LFS in the checkout step and added steps to ensure LFS objects are present before pushing to the Hugging Face mirror. This ensures large files tracked by LFS are properly handled during mirroring.

Files changed (1) hide show
  1. .github/workflows/hf-mirror.yml +10 -3
.github/workflows/hf-mirror.yml CHANGED
@@ -13,17 +13,25 @@ jobs:
13
  mirror:
14
  runs-on: ubuntu-latest
15
  steps:
16
- - name: Checkout (full history)
17
  uses: actions/checkout@v4
18
  with:
19
  fetch-depth: 0
20
- lfs: false
21
 
22
  - name: Configure git identity
23
  run: |
24
  git config user.name "github-actions[bot]"
25
  git config user.email "github-actions[bot]@users.noreply.github.com"
26
 
 
 
 
 
 
 
 
 
27
  - name: Push to HF mirror
28
  env:
29
  HF_USERNAME: ${{ secrets.HF_USERNAME }}
@@ -38,4 +46,3 @@ jobs:
38
  git remote add hf "https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/${HF_USERNAME}/${HF_REPO}.git" 2>/dev/null || true
39
  # Mirror current branch to HF main
40
  git push --force --prune hf HEAD:main
41
-
 
13
  mirror:
14
  runs-on: ubuntu-latest
15
  steps:
16
+ - name: Checkout (full history + LFS)
17
  uses: actions/checkout@v4
18
  with:
19
  fetch-depth: 0
20
+ lfs: true
21
 
22
  - name: Configure git identity
23
  run: |
24
  git config user.name "github-actions[bot]"
25
  git config user.email "github-actions[bot]@users.noreply.github.com"
26
 
27
+ - name: Ensure LFS objects are present
28
+ run: |
29
+ git lfs install
30
+ # Fetch any missing LFS content referenced by HEAD
31
+ git lfs fetch --all || true
32
+ git lfs checkout || true
33
+ echo "LFS files present:" && git lfs ls-files || true
34
+
35
  - name: Push to HF mirror
36
  env:
37
  HF_USERNAME: ${{ secrets.HF_USERNAME }}
 
46
  git remote add hf "https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/${HF_USERNAME}/${HF_REPO}.git" 2>/dev/null || true
47
  # Mirror current branch to HF main
48
  git push --force --prune hf HEAD:main