Simplify AgentStage configuration

This commit is contained in:
liuji
2026-10-10 16:58:51 +08:00
parent 1e4cb6bc1d
commit baae470d78
5 changed files with 13 additions and 24 deletions
-10
View File
@@ -1,10 +0,0 @@
# Gitea repository Secrets template.
# Create the two repository Secrets with these exact names under
# Repository Settings -> Actions -> Secrets, then enter values only in Gitea.
# This committed template intentionally contains no secret values.
# Git credential/token used by the publisher for the ttshop repository.
GIT_CREDENTIAL_SECRET=
# HTTPS endpoint receiving exactly one notification for a failed run.
SYNC_FAILURE_WEBHOOK_URL=
-9
View File
@@ -1,9 +0,0 @@
# Gitea repository Variables template (non-sensitive values only).
# Create these under Repository Settings -> Actions -> Variables.
# Do not place credentials or a webhook URL in this file.
# Public HTTPS origin of the Gitea instance, without repository path/query/fragment.
GITEA_BASE_URL=https://gitea.example.invalid
# One URL path segment identifying the repository owner or organization.
GITEA_OWNER=replace-with-gitea-owner
+11 -3
View File
@@ -8,13 +8,19 @@ TTSHOP 从公开的 Google Sheets 工作簿读取销售数据,生成合并后
## 数据同步 ## 数据同步
数据源是公开的 Google Sheets 工作簿,固定 ID 为: 数据源是公开的 Google Sheets 工作簿。`sync.py` 默认使用以下工作簿 ID:
```text ```text
1DPbdVsX3SG_kgDXs2j34mDAgplRSfcAWKKG9yqalFmw 1DPbdVsX3SG_kgDXs2j34mDAgplRSfcAWKKG9yqalFmw
``` ```
`sync.py` 的处理流程如下: 运行时可通过 `WORKBOOK_ID` 环境变量覆盖默认值,例如:
```sh
WORKBOOK_ID=your-workbook-id ./update.sh
```
未设置 `WORKBOOK_ID` 时,脚本继续使用上述默认值。`sync.py` 的处理流程如下:
1. 读取 XLSX 导出文件,获取工作表顺序。 1. 读取 XLSX 导出文件,获取工作表顺序。
2. 使用 Google Visualization API(gviz)读取各工作表中的显示值。 2. 使用 Google Visualization API(gviz)读取各工作表中的显示值。
@@ -52,7 +58,9 @@ TTSHOP 从公开的 Google Sheets 工作簿读取销售数据,生成合并后
AgentStage 自动执行仓库根目录的 `update.sh`,不使用 Gitea Actions workflow。 AgentStage 自动执行仓库根目录的 `update.sh`,不使用 Gitea Actions workflow。
`schedule.conf` 当前值为 `8`,表示每 8 小时自动运行一次。`update.sh` 会执行 `sync.py`;同步失败时返回非零状态。 `schedule.conf` 为单独一行 `3`,表示每 3 小时自动运行一次。`update.sh` 会执行 `sync.py`。
当前没有独立持久化的更新日志;AgentStage 任务日志以及脚本的 stdout/stderr 是运行日志。同步失败时脚本返回非零退出状态。只有在 AgentStage 运行环境中配置并注入 `SYNC_FAILURE_WEBHOOK_URL` 时,脚本才会发送一次失败 Webhook;未配置时不会发送主动通知。Webhook URL 必须由 AgentStage 运行环境注入,不会因为仓库中的模板文件而自动生效。
## 本地手动运行 ## 本地手动运行
+1 -1
View File
@@ -1 +1 @@
8 3
+1 -1
View File
@@ -19,7 +19,7 @@ import requests
ROOT = Path(__file__).resolve().parent ROOT = Path(__file__).resolve().parent
WORKBOOK_ID = "1DPbdVsX3SG_kgDXs2j34mDAgplRSfcAWKKG9yqalFmw" WORKBOOK_ID = os.getenv("WORKBOOK_ID", "1DPbdVsX3SG_kgDXs2j34mDAgplRSfcAWKKG9yqalFmw")
PUBLISH_PATH = Path("data/merged.html") PUBLISH_PATH = Path("data/merged.html")
GVIZ_PREFIX = "google.visualization.Query.setResponse(" GVIZ_PREFIX = "google.visualization.Query.setResponse("