github / vscode-github-actions

GitHub Actions extension for VS Code
https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-github-actions
MIT License
469 stars 70 forks source link

"Context access might be invalid: workspace" #314

Open MathiasMagnus opened 3 months ago

MathiasMagnus commented 3 months ago

Describe the bug

If a workflow YAML has ${{runner.workspace}} value for the key jobs.<job_id>.steps[*].working-directory it triggers the warning in the issue description.

To Reproduce

- name: Test
  working-directory: ${{runner.workspace}}/OpenCL-Headers/build

Expected behavior

No warning.

Screenshots

kép

Extension Version

v0.26.2

Additional context

None.

muzimuzhi commented 3 months ago

runner.workspace is (now) an undocumented context property.

From the source file of Contexts docs,

{%- comment %}
The `runner.workspace` property is purposefully not documented. It is an early Actions property that now isn't relevant for users, compared to `github.workspace`. It is kept around for compatibility.
| `runner.workspace` | `string` | |
{%- endcomment %}

Maybe you can use github.workspace instead. Note runner.workspace and github.workspace are slightly different, see for example https://github.com/actions/runner/issues/728.

MathiasMagnus commented 2 months ago

We specifically have to use that because of the subtle difference. We use custom images in GA and this variable resolves to the correct folder.