fix(cicd): PR CI 模板同款 lint 语法雷,防止复制到子项目
All checks were successful
Push Check / check (push) Successful in 51s
All checks were successful
Push Check / check (push) Successful in 51s
炼境自身 pr-check.yml 刚踩的 pnpm lint --if-present 必挂 bug, 源头就是 build_pr_ci_workflow 模板——每个经炼境生成 CI 的子项目 都会领到坏 workflow。改为 pnpm run --if-present 语法(本地实测 exit 0),并在 pr_ci_template_is_correct 加回归断言驻军。 Rules-Applied: R07,R10
This commit is contained in:
parent
a1a4748c58
commit
dc501f74e2
@ -391,8 +391,8 @@ jobs:
|
|||||||
|
|
||||||
- run: pnpm install --frozen-lockfile
|
- run: pnpm install --frozen-lockfile
|
||||||
- run: {build_cmd}
|
- run: {build_cmd}
|
||||||
- run: pnpm lint --if-present
|
- run: pnpm run --if-present lint
|
||||||
- run: pnpm test --if-present --passWithNoTests
|
- run: pnpm run --if-present test --passWithNoTests
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -546,6 +546,16 @@ mod tests {
|
|||||||
let (content, filename, secrets) = build_pr_ci_workflow(&cfg("pr_ci"));
|
let (content, filename, secrets) = build_pr_ci_workflow(&cfg("pr_ci"));
|
||||||
assert!(content.contains("pull_request"), "触发器应为 pull_request");
|
assert!(content.contains("pull_request"), "触发器应为 pull_request");
|
||||||
assert!(content.contains("pnpm build"), "应含构建步骤");
|
assert!(content.contains("pnpm build"), "应含构建步骤");
|
||||||
|
// --if-present 只对 pnpm run 子命令有效,直接 `pnpm lint --if-present` 会把
|
||||||
|
// lint 当外部命令执行报 ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL(炼境自身 CI 踩过)
|
||||||
|
assert!(
|
||||||
|
content.contains("pnpm run --if-present lint"),
|
||||||
|
"lint 步骤须用 pnpm run --if-present 语法"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
content.contains("pnpm run --if-present test"),
|
||||||
|
"test 步骤须用 pnpm run --if-present 语法"
|
||||||
|
);
|
||||||
assert!(!content.contains("SERVER_HOST"), "不应含 SSH 部署配置");
|
assert!(!content.contains("SERVER_HOST"), "不应含 SSH 部署配置");
|
||||||
assert!(!content.contains("ssh-action"), "不应含 SSH Action");
|
assert!(!content.contains("ssh-action"), "不应含 SSH Action");
|
||||||
assert_eq!(filename, "pr-check.yml");
|
assert_eq!(filename, "pr-check.yml");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user