github / github/vscode-github-actions
Do not warn about missing values if a fallback is provided
- 主要語言
- TypeScript
- 星號
- 660
- 分支
- 213
- PR 合併指標
- 30 天內沒有已合併 PR
描述
**Is your feature request related to a problem? Please describe.**
I want to allow many values to be overridden using `vars` but still provide defaults/fallback values when the var is not set. This is possible with the "or" operator:
```
${{vars.optional_config || 'default value'}}
```
However, this currently generates a warning "Context access might be invalid: optional_config"
**Describe the solution you'd like**
The static analyser should detect that the `||` operator provides a default and not generate a warning.
Alternatively, provide a function (e.g. `val_or_default(vars.optional_config, 'default value')`) to make the user's intention explicit to the linter.
貢獻指南
研究方向
Start by locating the static analyser that reports “Context access might be invalid” and reproduce the issue with the provided `vars.optional_config || 'default value'` expression. The work is done when an expression with an `||` fallback no longer produces a missing-value warning, while the existing warning behavior remains for unguarded access.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- typescript, vscode
- 領域
- devtools
- Issue 類型
- 功能
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100