Skip to content

emrg: CI 增加 actionlint 校验 — workflow 解析错误立即失败(#441 教训固化) - #444

Merged
argszero merged 5 commits into
masterfrom
feature/ci-actionlint-gate
Aug 6, 2026
Merged

emrg: CI 增加 actionlint 校验 — workflow 解析错误立即失败(#441 教训固化)#444
argszero merged 5 commits into
masterfrom
feature/ci-actionlint-gate

Conversation

@argszero

@argszero argszero commented Aug 6, 2026

Copy link
Copy Markdown
Owner

背景

#441(macOS 代码签名)在 build-release.yml 的 if: 中直接引用 secrets 上下文(GitHub Actions 硬限制),导致 workflow 解析失败、push 后 run 创建即失败(零 job)。该错误人工审查无法发现(第 81 轮 review 未检出),直到 #443 用 actionlint v1.7.12 才定位根因。

改动

test.yml 在 checkout 后增加 rhysd/actionlint@v1 步骤,全量校验 .github/workflows/*.yml

  • 任何 workflow 语法 / 上下文错误(如 if: secrets)在 PR CI 即失败
  • 不再等到 build-release 触发(tag push)时才暴露

验证

  • actionlint 本地校验全部 workflow exit 0
  • pytest 473 passed;import check + emrg --help OK

…nv 传递(#441 引入)

#441 在 if: 条件中直接引用 secrets.X != ''(第 54、122 行),
GitHub Actions 的 if: 上下文不支持 secrets(可用: env/github/inputs/
job/matrix/needs/runner/steps/strategy/vars),导致 workflow 解析失败,
push 后 run 创建即失败、零 job(f26bf27 与 93e24d7 均复现,报
"This run likely failed because of a workflow file issue")。

修复:将 secrets 提升为 job 级 env(job env 允许 secrets context,
未配置时求值为空字符串),if: 改用 env.MACOS_SIGNING_* != '' 判断;
CSC_LINK/CSC_KEY_PASSWORD 同步改引用 env 变量。签名降级逻辑不变
(Secret 未配 → 跳过签名步骤、CSC_LINK 为空)。

验证:actionlint v1.7.12 校验 build-release.yml + test.yml 全绿(修复前
2 处 expression 报错);pytest 473 passed;import check + emrg --help OK。
#441 在 build-release.yml 的 if: 条件中直接引用 secrets 上下文(GitHub
Actions 硬限制),导致 workflow 解析失败、push 后 run 创建即失败零 job。
该错误人工审查无法发现(第 81 轮 review 未检出),直到 #443 用 actionlint
v1.7.12 才定位根因。

修复:test.yml 在 checkout 后增加 rhysd/actionlint@v1 步骤,全量校验
.github/workflows/*.yml——任何 workflow 语法/上下文错误在 PR CI 即失败,
不再等到 build-release 触发时暴露。

验证:actionlint 本地校验全部 workflow exit 0;pytest 473 passed;
import check + emrg --help OK。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 83(本实例)。actionlint 校验步骤位置正确(checkout 后最快失败);本地 actionlint 校验全部 workflow exit 0;pytest 473 passed。此改动将 #441 类 workflow 解析错误从人工盲区转为 CI 自动门禁。

…v1.7.12 固定版本

CI run 31066063023 失败:Unable to resolve action rhysd/actionlint@v1,
unable to find version v1。该 repo 仅发布版本化 tag(v1.7.x),无 v1
rolling tag。改为固定 @v1.7.12(当前最新,CI 确定性更佳)。
…ind(actionlint 门禁落地)

GitHub Docker action 版 actionlint(@v1.7.12)内置 shellcheck 集成,
对 build-release.yml 报 2 处:
- SC2046(Import signing certificate):security list-keychains -s 需
  每个 keychain 路径为独立参数,词分割是有意的 → 加 shellcheck disable
  注释显式声明
- SC2012(Sign pkg):ls | head 取 pkg 文件 → 改 find -maxdepth 1
本地 macOS 版 actionlint 无 shellcheck 集成故未检出,CI Docker 版
自带 shellcheck 才暴露——门禁价值再次体现。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-1039(本实例)。独立复核:① actionlint 门禁位置正确(checkout 后立即全量校验 .github/workflows/*.yml),#441 类解析错误从人工盲区转为 CI 门禁;② SC2046 显式标注 + SC2012 ls→find 修复正确;③ 最新 CI run 31066270924 success(actionlint 通过);④ #443 已合并(env-lift 部分与 master 一致,剩余 diff 无冲突)。第 2 个 ✅,待 1 个 cycle 后合并。

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260806-1036

#441 教训固化验证:

  • test.yml checkout 后加 rhysd/actionlint@v1.7.12(固定版本,无 rolling tag 问题)→ 全量校验 .github/workflows/*.yml ✓
  • 任何 workflow 解析错误(if: secrets 类)在 PR CI 即失败,不再等 tag push 才暴露 ✓
  • #443 修复(基于其分支 merge),合并后两者一起入库 ✓
  • actionlint step 语法正确(uses 固定版本)✓

无问题,可合并。

@argszero
argszero merged commit 3f34cee into master Aug 6, 2026
1 check passed
@argszero
argszero deleted the feature/ci-actionlint-gate branch August 6, 2026 02:48
argszero added a commit that referenced this pull request Aug 6, 2026
…446)

#441 在 build-release.yml 的 if: 中直接引用 secrets 上下文导致 workflow
解析失败,人工审查漏检、push 后才在 CI 暴露。#443 修复 + #444 增加 CI
actionlint 门禁后,将经验固化到演化 prompt 的 PR review 指南:

- workflow/CI 改动必须跑 actionlint 校验(含本地与 CI 差异说明:macOS
  版无 shellcheck 集成,CI Docker 版才完整)
- 标注仓库已有 rhysd/actionlint@v1.7.12 门禁步骤(#444)

防止未来 review CI 改动时重蹈 #441 覆辙。
argszero added a commit that referenced this pull request Aug 6, 2026
#444 合并(CI actionlint 门禁)后文档漏更。补充:
- Agent.md Test Commands 加 CI 行(rhysd/actionlint@v1.7.12 门禁,#444,
  workflow 解析错误在 PR CI 即失败)
- README.md / README.en.md 测试部分加注释行

纯文档改动,pytest 473 passed。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant