question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting strategy.matrix to variable value returns a "invalid workflow file" error

See original GitHub issue

Describe 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

  1. 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)
  2. Push up to any repo
  3. 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:closed
  • Created 3 years ago
  • Reactions:26
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
cdbcommented, Oct 12, 2020

We have rolled out 2 bug fixes now, to cover both the cases in this issue (matrix: ${{ expression }}, and strategy: ${{ expression }}, and have added additional unit test coverage. Thanks for reporting this and let us know if you continue to see the issue!

4reactions
sindrigcommented, Oct 12, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found