Mystyc commited on
Commit
6ae3cea
·
1 Parent(s): 5a35b99
Files changed (1) hide show
  1. .github/workflows/hf-sync.yml +9 -6
.github/workflows/hf-sync.yml CHANGED
@@ -16,20 +16,23 @@ jobs:
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
 
 
 
16
 
17
  - name: Mirror to HF Space
18
  env:
19
+ HF_TOKEN: ${{ secrets.HF_TOKEN }} # token write
20
+ HF_SPACE: Mystyc/bg-proxy # ganti jika perlu
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
  HF_URL="https://user:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE}"
27
 
28
+ # pastikan remote ada
29
  git remote remove hf 2>/dev/null || true
30
  git remote add hf "$HF_URL"
31
 
32
+ # >>> kuncinya: fetch dulu supaya lease tidak "stale"
33
+ git fetch hf main || true
34
+
35
+ # dorong commit sekarang ke HF
36
  git push --force-with-lease hf HEAD:main
37
+ # kalau kamu ingin SELALU menimpa HF, pakai:
38
+ # git push --force hf HEAD:main