Repository navigation
ci: 冒烟地址自动推导——APP_URL 降为可选 (ONE-513) - #157
Merged
Merged
Conversation
- smoke-test.sh:APP_URL 已配照旧探它;未配则用 CLOUDFLARE_API_TOKEN + ACCOUNT_ID 从 Cloudflare API 读取账户 workers.dev 子域名,拼出 https://<worker>.<subdomain>.workers.dev 后探测;两者皆无才报错。 - 先查 Worker 的 workers.dev 开关,被关时明确报「workers.dev 未启用、 不是应用故障」,并提示改用 APP_URL。 - deploy.yml 的 Smoke 步补 ACCOUNT_ID 与 CLOUDFLARE_API_TOKEN;APP_URL 仍取 vars.APP_URL(可选,保留)。 - test-deploy-checks.mjs 新增 7 个用例(本地 mock curl,不调生产): 自动推导并探三路径、APP_URL 优先不调 API、workers.dev 关闭报错、 开关读不到仅警告、API 失败提示权限且不泄露 token、两者皆无报错、 Smoke 步 env 结构。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动 E(规格 v1.1 §4A)
Smoke 步不再强制要求
vars.APP_URL:已配则照旧探它(自定义域名是真实生产入口);未配则通过 Cloudflare API 解析本 Worker 的 workers.dev 地址后探它;两者皆无才报错。解析方式(主选:CF API)
workers.dev 主机名 =
https://<worker 名>.<账户 workers.dev 子域名>.workers.dev,子域名是账户级字符串、与 account id 无公式关系。按官方 OpenAPI(cloudflare/api-schemas)核实端点语义:GET /accounts/{account_id}/workers/scripts/{script_name}/subdomain→{enabled, previews_enabled},即「该 Worker 是否挂在 workers.dev 上」,不返回子域名字符串;GET /accounts/{account_id}/workers/subdomain→{subdomain},token 权限组含Workers Scripts Read|Write。因此实现先用前者判定开关(关闭时明确报「workers.dev 未启用、不是应用故障」),再用后者取子域名字符串拼接地址。数据面与字符串都来自 API,无新配置项。
文件
.github/scripts/smoke-test.sh:三路径解析 + workers.dev 关闭/API 失败的明确报错;探测路径与 challenge 判定原样复用。.github/workflows/deploy.yml:Smoke 步 env 补ACCOUNT_ID、CLOUDFLARE_API_TOKEN;APP_URL: ${{ vars.APP_URL }}保留(未配则空)。.github/scripts/test-deploy-checks.mjs:+7 用例(本地 mock curl,不调生产)。自测
node --test .github/scripts/test-d1-migrations.mjs .github/scripts/test-deploy-checks.mjs→ 49 tests / 49 passshellcheck .github/scripts/smoke-test.sh→ 0 告警;actionlint .github/workflows/deploy.yml→ 通过pnpm check/typecheck/test(55 web + 110 worker)/build→ 通过无迁移、无数据改动;回滚即 revert 本 commit。