pengqi
commited on
Update sync-to-hf.yml
Browse files
.github/workflows/sync-to-hf.yml
CHANGED
|
@@ -1,24 +1,30 @@
|
|
| 1 |
-
name: Sync to Hugging Face
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
-
branches:
|
| 6 |
-
- main # 触发分支,按需修改
|
| 7 |
|
| 8 |
jobs:
|
| 9 |
sync:
|
| 10 |
runs-on: ubuntu-latest
|
| 11 |
steps:
|
| 12 |
-
- name: Checkout
|
| 13 |
uses: actions/checkout@v4
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
- name:
|
| 16 |
run: |
|
| 17 |
git config --global user.name "GitHub Actions"
|
| 18 |
git config --global user.email "actions@github.com"
|
| 19 |
|
| 20 |
-
- name:
|
| 21 |
-
run:
|
|
|
|
| 22 |
|
| 23 |
-
- name:
|
| 24 |
-
run:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Force Sync to Hugging Face
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
+
branches: [main]
|
|
|
|
| 6 |
|
| 7 |
jobs:
|
| 8 |
sync:
|
| 9 |
runs-on: ubuntu-latest
|
| 10 |
steps:
|
| 11 |
+
- name: Checkout GitHub 代码(完整历史)
|
| 12 |
uses: actions/checkout@v4
|
| 13 |
+
with:
|
| 14 |
+
fetch-depth: 0 # 关键!禁用浅克隆,拉取完整历史
|
| 15 |
|
| 16 |
+
- name: 配置 Git 身份
|
| 17 |
run: |
|
| 18 |
git config --global user.name "GitHub Actions"
|
| 19 |
git config --global user.email "actions@github.com"
|
| 20 |
|
| 21 |
+
- name: 添加 Hugging Face 远程仓库
|
| 22 |
+
run: |
|
| 23 |
+
git remote add hf https://dongsiqie:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/dongsiqie/q.git
|
| 24 |
|
| 25 |
+
- name: 强制推送覆盖 Hugging Face
|
| 26 |
+
run: |
|
| 27 |
+
# 禁用 LFS 验证(解决 remote: Unexpected internal error hook: lfs-verify)
|
| 28 |
+
git lfs uninstall
|
| 29 |
+
# 强制推送覆盖(关键命令)
|
| 30 |
+
git push hf main --force
|