actions / actions/runner

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

Open
#1,985 16 comments 64 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
6.3k
Forks
1.4k
Avg merge
1d 16h
Merged PRs (30d)
24

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported workflow using the job-level if condition and matrix definition shown in the issue, then inspect the runner's handling of expression contexts at that point. Done means determining whether matrix.customer.schema can be evaluated there and documenting or resolving the behavior with coverage for the reported example.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions
Domain
ci-cd, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.