github / github/vscode-github-actions
Yaml validation fail when using expession in job env or step env
- Dominant language
- TypeScript
- Stars
- 660
- Forks
- 213
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
I have a workflow that uses a matrix that define env to use with each job.
Using expression to set the job env fail validation.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a workflow file like this
```
---
on:
push: {}
jobs:
myjob:
strategy:
matrix:
include:
- name: 'env1'
runs-on: 'ubuntu-22.04'
env:
VAR1: 'value1'
VAR2: 'value2'
- name: 'env2'
runs-on: 'ubuntu-24.04'
env:
VAR1: 'value3'
VAR2: 'value4'
name: ${{ matrix.name }}
runs-on: ${{ matrix.runs-on }}
env: ${{ matrix.env }}
steps:
- name: Run tests
run: 'echo "var1: $VAR1, var2: $VAR2"'
```
2. See validation error in vscode
```
`Unexpected type 'BasicExpressionToken' encountered while reading 'job env'. The type 'MappingToken' was expected.`
```
3: running the workflow produces
env1
```
Run echo "var1: $VAR1, var2: $VAR2"
var1: value1, var2: value2
```
env2
```
Run echo "var1: $VAR1, var2: $VAR2"
var1: value3, var2: value4
```
No errors.
**Expected behavior**
I would expect validation not to produce an error like this
Contributor guide
Assessment
This issue has not been assessed yet.