update
Browse files
.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 }}
|
| 20 |
-
HF_SPACE: Mystyc/bg-proxy
|
| 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 |
-
#
|
| 30 |
git remote remove hf 2>/dev/null || true
|
| 31 |
git remote add hf "$HF_URL"
|
| 32 |
|
| 33 |
-
#
|
| 34 |
-
|
|
|
|
|
|
|
| 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
|