Mystyc commited on
Commit
1d39f17
·
1 Parent(s): 38fe300
Files changed (1) hide show
  1. .github/workflows/hf-sync.yml +16 -7
.github/workflows/hf-sync.yml CHANGED
@@ -12,15 +12,24 @@ jobs:
12
  - uses: actions/checkout@v4
13
  with:
14
  fetch-depth: 0
15
- lfs: true # supaya file LFS ikut ter-handle
16
 
17
- - name: Push to Hugging Face
18
  env:
19
- HF_TOKEN: ${{ secrets.HF_TOKEN }}
 
20
  run: |
 
21
  git config --global user.name "github-actions[bot]"
22
  git config --global user.email "github-actions[bot]@users.noreply.github.com"
23
- git remote add hf https://huggingface.co/spaces/Mystyc/bg-proxy || true
24
- # Jika GitHub adalah "source of truth", gunakan force-with-lease:
25
- git -c http.extraHeader="Authorization: Bearer $HF_TOKEN" push --force-with-lease hf HEAD:main
26
- # Jika TIDAK ingin menimpa riwayat di HF, hapus flag --force-with-lease di atas.
 
 
 
 
 
 
 
 
12
  - uses: actions/checkout@v4
13
  with:
14
  fetch-depth: 0
15
+ lfs: true
16
 
17
+ - name: Mirror to HF Space
18
  env:
19
+ HF_TOKEN: ${{ secrets.HF_TOKEN }} # pastikan secret ini ada (scope: write)
20
+ HF_SPACE: Mystyc/bg-proxy # ganti kalau beda
21
  run: |
22
+ set -e
23
  git config --global user.name "github-actions[bot]"
24
  git config --global user.email "github-actions[bot]@users.noreply.github.com"
25
+
26
+ # URL dengan Basic auth (username dummy 'user', password = token)
27
+ HF_URL="https://user:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE}"
28
+
29
+ # Tambahkan/replace remote 'hf'
30
+ git remote remove hf 2>/dev/null || true
31
+ git remote add hf "$HF_URL"
32
+
33
+ # Dorong HEAD ke branch main di HF
34
+ # Jika TIDAK ingin menimpa riwayat di HF, hapus --force-with-lease
35
+ git push --force-with-lease hf HEAD:main