Skip to content

Commit 6c2eb4c

Browse files
committed
更新 README.md,添加 Hugging Face 访问令牌配置说明;更新工作流,增加可选的自动同步到 Hugging Face Space 功能
1 parent c9942c8 commit 6c2eb4c

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

.github/workflows/main.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,19 @@ jobs:
4545
git push origin main
4646
env:
4747
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: 同步到 Hugging Face Space (可选)
50+
if: ${{ secrets.HF_TOKEN != '' }}
51+
env:
52+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
53+
run: |
54+
set -e
55+
sudo apt-get update && sudo apt-get install -y rsync
56+
git config --global user.name 'github-actions[bot]'
57+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
58+
git clone https://huggingface.co/spaces/Viper3733/LOL-DeepWinPredictor hf_repo
59+
rsync -av --delete --exclude='.git' --exclude='hf_repo' ./ hf_repo/
60+
cd hf_repo
61+
git add .
62+
git diff --cached --quiet || git commit -m "数据自动更新 (来自 GitHub Actions)"
63+
git push https://user:$HF_TOKEN@huggingface.co/spaces/Viper3733/LOL-DeepWinPredictor main

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
JSON_PROMPT=$(printf "%s" "$FULL_PROMPT" | jq -Rs .)
7676
cat <<EOF > request.json
7777
{
78-
"model": "x-ai/grok-4-fast:free",
78+
"model": "z-ai/glm-4.5-air:free",
7979
"messages": [
8080
{
8181
"role": "user",

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ pinned: false
193193
| MONGO_URI | MongoDB连接URI | 必填 |
194194
| PROXY | 代理配置(JSON字符串,例:{'http': 'http://127.0.0.1:7890', 'https': 'http://127.0.0.1:7890'}) | 可选 |
195195
| GH_TOKEN | GitHub访问令牌(用于自动发布Release) | 必填 |
196+
| HF_TOKEN | Hugging Face 访问令牌(用于自动同步数据到 HF Space) | 可选 |
196197

197198
> ⚠️ 代理配置(PROXY)为可选项,若部署环境无法直接访问外网或有特殊网络需求时可设置。
198199
@@ -204,6 +205,12 @@ pinned: false
204205
- **定时自动运行**:每周日 0点自动拉取和更新数据集。
205206
- **手动触发**:可在 GitHub Actions 页面点击手动运行。
206207

208+
- **(可选)自动同步到 Hugging Face Space**:若已在仓库 Secrets 配置 `HF_TOKEN`,工作流会在将变更推送到 GitHub 后,自动把更新内容(保持原路径结构)同步到 `spaces/Viper3733/LOL-DeepWinPredictor`
209+
210+
获取并配置 `HF_TOKEN`
211+
- 在 Hugging Face 设置页面创建 Token(`https://huggingface.co/settings/tokens`),授予 write 权限。
212+
- 在 GitHub 仓库 Settings → Secrets and variables → Actions 中新增 Secret:`HF_TOKEN`
213+
207214
只需在仓库设置好环境变量,GitHub Actions 会自动完成数据采集与更新,无需手动操作服务器。
208215

209216
---

0 commit comments

Comments
 (0)