github / github/vscode-github-actions

The `runner.environment` context is shown as invalid in this extension.

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

描述

**Describe the bug**
When we use the `runner.environment` context listed in [official document](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#runner-context), this extension reports "Context access might be invalid".

**To Reproduce**
Steps to reproduce the behavior:
1. With this workflow '...'

```yaml
steps:
- if: ${{ runner.environment == 'github-hosted' }}
run: echo "This is a ${{ runner.environment }} runner"
```

2. Do this '...'

Open the "Problems" Panel.

3. See error\

```plain
Context access might be invalid: environment
```

**Expected behavior**
The `runner.environment` context listed in [official document](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#runner-context) can be recognized well by this extension.

**Screenshots**
![image](https://github.com/user-attachments/assets/335f46d8-d511-4f91-a2dd-5c78b5c0c1e3)

**Extension Version**
`v0.27.0`

**Additional context**
Add any other context about the problem here.

贡献指南

打开贡献指南

调研方向

Start by reproducing the supplied workflow snippet in the extension and inspect the context-validation path that produces the Problems-panel warning. The work is done when runner.environment is recognized according to the linked GitHub Actions runner-context documentation and the warning no longer appears for this expression.

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

评估

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

把新 issue 发到你的邮箱

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