update
Browse files
.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
|
| 16 |
|
| 17 |
-
- name:
|
| 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 |
-
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|