github / github/vscode-github-actions

The pythonLocation environment variable is shown as invalid access in this context

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

描述

### **Describe the bug**
When using the `pythonLocation` environment variable set by the `actions/setup-python` action, this extension reports "Context access might be invalid" even though it is a valid environment variable documented in the official setup-python action.

### **To Reproduce**
Steps to reproduce the behavior:

1. With this workflow:

```yaml
name: Test Workflow

on:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Cache pip
uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}/.cache/pip
key: python-${{ hashFiles('setup.py', 'pyproject.toml') }}
```

2. Open the "Problems" panel in VS Code.

3. See the error:
```
Context access might be invalid: pythonLocation
```

### **Expected behavior**
The `pythonLocation` environment variable, which is documented and valid when using `actions/setup-python`, should be recognized properly by this extension.

### **Screenshots**
If applicable, include screenshots of the warning in the Problems panel.

### **Extension Version**
`vX.Y.Z`

### **Additional context**
- Official documentation for the `pythonLocation` variable: [[setup-python environment variables](https://github.com/actions/setup-python#outputs-and-environment-variables)](https://github.com/actions/setup-python#outputs-and-environment-variables).
- This warning is a false positive, as the workflow executes without issues and the variable is set correctly.
- Is this a bug or a limitation of the extension?

---

贡献指南

打开贡献指南

调研方向

Start by reproducing the warning from the workflow shown in the issue and inspect the diagnostic reported in VS Code's Problems panel. Trace how the extension validates environment-variable context access; done means the documented pythonLocation usage no longer produces a false-positive warning while the workflow remains valid.

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

评估

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

把新 issue 发到你的邮箱

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