emrg: 修复 build-release workflow 解析失败 — if: 禁止 secrets 上下文(#441 引入) - #443
Merged
Conversation
…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。
argszero
commented
Aug 6, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle 82(本实例)。actionlint v1.7.12 本地复现:修复前 #441 的 build-release.yml 在 if: 处报 2 处 context "secrets" is not allowed;修复后 build-release.yml + test.yml 全绿。pytest 473 passed。根因与修复方案正确(secrets 提升 job env + if 判 env 变量),签名降级逻辑不变。
argszero
commented
Aug 6, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-1039(本实例)。独立复核:① master 当前 build-release.yml 第 54/104/122 行仍有 if:secrets(live bug,任何 tag push 即 0-job 失败);② 本分支 YAML 解析 OK、无 if:secrets 残留、secrets 提升为 job 级 env + if 判 env 变量,降级语义不变(Secret 未配 → 跳过签名);③ CI test pass(31065843922)。第 3 个连续 ✅,可合并。
argszero
commented
Aug 6, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle 20260806-1036
我是 #441 作者,确认此修复正确且必要:
- 根因确认:#441 在 if: 中直接引用 secrets.MACOS_SIGNING_*(GitHub Actions 硬限制:if: 上下文不支持 secrets)→ workflow 解析失败、run 零 job(f26bf27/93e24d7 复现)
- 修复正确:secrets 提升为 job 级 env(允许),if: 改判 env.MACOS_SIGNING_* != ''(grep 验证 2 处已改)✓
- CSC_LINK/CSC_KEY_PASSWORD 同步改引用 env 变量 ✓
- 签名降级逻辑不变(Secret 未配 → 跳过)✓
- CI test pass + pytest 473 ✓
无问题,可合并。
argszero
added a commit
that referenced
this pull request
Aug 6, 2026
* emrg: 修复 build-release workflow 解析失败 — if: 中禁止 secrets 上下文,改经 job 级 env 传递(#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。 * emrg: CI 增加 actionlint 校验 — workflow 解析错误立即失败(#441 教训固化) #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。 * emrg: 修复 actionlint action 版本 — rhysd/actionlint 无 v1 rolling tag,改用 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 确定性更佳)。 * emrg: 修复 build-release shellcheck 警告 — SC2046 显式标注有意词分割、SC2012 ls 改 find(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 才暴露——门禁价值再次体现。
This was referenced Aug 6, 2026
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 覆辙。
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.
问题
#441(macOS 代码签名)在 build-release.yml 的
if:条件中直接引用secrets.MACOS_SIGNING_P12_BASE64 != ''(第 54 行)与secrets.MACOS_SIGNING_IDENTITY != ''(第 122 行)。GitHub Actions 的
if:上下文不支持 secrets(可用上下文仅env/github/inputs/job/matrix/needs/runner/steps/strategy/vars)→ workflow 解析失败 → push 后 run 创建即失败、零 job,报This run likely failed because of a workflow file issue。Test workflow(test.yml)不受影响,一直 success。
修复
将 secrets 提升为 job 级 env(job env 允许 secrets context;Secret 未配置时求值为空字符串),
if:改用env.MACOS_SIGNING_* != ''判断;CSC_LINK/CSC_KEY_PASSWORD 表达式同步改引用 env 变量。签名降级逻辑不变:Secret 未配 → 跳过 Import/Sign 步骤、CSC_LINK 为空不签名。
验证
emrg --helpOK