github / github/vscode-github-actions

Missing expression syntax or escaping for `if: ! expr` is not detected

未关闭
#290 1 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
TypeScript
星标
660
派生
213
PR 合并指标
30 天内没有已合并 PR

描述

The following is not validated (from [github docs](https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution)):

> You must always use the ${{ }} expression syntax or escape with '', "", or () when the expression starts with !, since ! is reserved notation in YAML format. For example:
>
> ```
> if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
> ```
>
> For more information, see "[Expressions](https://docs.github.com/en/actions/learn-github-actions/expressions)."

Currently, this will not be detected as a bug:
```
if: ! startsWith(github.ref, 'refs/tags/')
```

The runner will abort with:
```
The workflow is not valid. .github/workflows/build.yml: (Line: 42, Col: 42, Idx: 420) - (Line: 42, Col: 43, Idx: 421): While parsing a tag, did not find expected tag URI.
```

It should be linted as an error.

贡献指南

打开贡献指南

调研方向

在 .github/workflows/build.yml 中复现 issue 里的未转义表达式,并将其与文档记录的转义形式进行比较。跟踪 extension 当前的 workflow 验证入口点和现有诊断;完成标准是未转义形式收到 lint 错误,而有效的转义形式和表达式形式仍然被接受。

由索引模型根据 Issue 内容生成。

评估

技术栈
github-actions, typescript
领域
ci-cd, devtools
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。