Skip to content

Unrecognized named-value: 'matrix' in job if conditional #1985

Description

@Joe-Kollin

Describe the bug
A job generates a matrix as an output and I have a subsequent job that depends on the generation of that matrix. The first job does an API call to get all customers which each have a unique schema association. I only want to run this second job in the event that my input SCHEMA array contains the schema of a given return record. However, when I execute the build I get the following error: Unrecognized named-value: 'matrix'. Located at position 26 within expression: contains(inputs.SCHEMAS, matrix.customer.schema). The pattern works without the conditional, but does not fit my use case.

This is a rough idea of what the job looks like.

job-name:
  runs-on: ubuntu-latest
  needs: get-customers
  if: contains(inputs.SCHEMAS, matrix.customer.schema)
  strategy:
    matrix:
      customer: ${{fromJson(needs.get-customers.outputs.customers)}}
  steps:
     ....

Expected behavior
The job should only run when the matrix schema is contained within the input SCHEMA

Runner Version and Platform

ubuntu-latest

What's not working?

The use of matrix in a job level conditional

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions