fix: repair invalid yaml in issue close workflow - #2952
Merged
Conversation
The Chinese continuation lines in the github-script body were written with zero indentation, which terminated the 'script: |' literal block scalar early and made the workflow file invalid YAML. Use single-line JS strings joined with \n instead of multi-line template literals.
|
|
commit: |
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.
问题
合并 PR #2946 时 GitHub 报错:
原因
提交 0df187e(经 PR #2941 合入)把 workflow 重写为
actions/github-script@v7版本,其中两处body的中文续行写成了零缩进(顶格)。这导致 YAML 的script: |字面量块标量提前结束,后面的},被当作 YAML 结构解析,触发语法错误(line 25)。修复
将两处多行模板字符串改为单行 JS 字符串 +
\n换行,彻底避免多行 YAML 标量的缩进陷阱:已通过
ruby -ryaml解析校验,YAML OK。