Setting strategy.matrix to variable value returns a "invalid workflow file" error
See original GitHub issueDescribe the bug
It seems that we can no longer set matrix.strategy
to an output of a previous job. Trying to do so will cause the job to immediately fail with a “Invalid Workflow file” error.
To Reproduce
- Use the example from the Context and Expression syntax guide from the GitHub Actions docs (https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#example-6)
- Push up to any repo
- The workflow file error will come up immediately
Expected behavior There should not be a workflow file error unless something has changed about matrix variables/syntax
Runner Version and Platform
Version of your runner? ubuntu-latest
What’s not working?
An example can be found here The error text is: “Invalid workflow file You have an error in your yaml syntax on line 15”
Job Log Output
No job log output as the jobs never run
Runner and Worker’s Diagnostic Logs
No diagnostic logs available
For reference here is the example from the docs pasted fully:
name: build
on: push
jobs:
job1:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: echo "::set-output name=matrix::{\"include\":[{\"project\":\"foo\",\"config\":\"Debug\"},{\"project\":\"bar\",\"config\":\"Release\"}]}"
job2:
needs: job1
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJson(needs.job1.outputs.matrix)}}
steps:
- run: build
Issue Analytics
- State:
- Created 3 years ago
- Reactions:26
- Comments:8 (1 by maintainers)
Top Results From Across the Web
elixir - GitHub Actions Invalid Workflow File Error
2 Answers. You have too many - where you are defining the step. There should only be one - per step in the...
Read more >How-to Github Actions: Build Matrix
My favorite feature of Github Action is build matrix. A build matrix is a set of keys and values that allows you to...
Read more >GitHub Action: How can I define an array in job1, and ...
My action code is below. My eventual goal is to define an array of SHA values in job1, then pass that array to...
Read more >Built-in and custom Harness variables reference
Harness variables are a way to refer to something in Harness, such as an entity name or a configuration setting. At pipeline runtime,...
Read more >Variable string array not working in Invoke Workflow - Studio
Hello, I'm trying to call workflow files from an invoke workflow activity by iterating around each external workflow.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have rolled out 2 bug fixes now, to cover both the cases in this issue (
matrix: ${{ expression }}
, andstrategy: ${{ expression }}
, and have added additional unit test coverage. Thanks for reporting this and let us know if you continue to see the issue!According to @cschleiden this should have been resolved. See discussion here: https://github.community/t/dynamic-matrix-yaml-syntax-error/136705/7
We would like some kind of an explanation and/or what will be done to prevent something like this again.