Cannot access matrix inside `if`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Cannot access matrix inside if in jobs.
To Reproduce
Steps to reproduce the behavior:
# workflow.yml
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
module: ['admin', 'server']
if: ${{ contains('admin', matrix.module) }}
steps:
- name: Run a one-line script
run: echo Hello, world!
When I run this action, i got an error like below.

Expected behavior
I can access to 'matrix' in if. In docs,
You can access this context from any job or step in a workflow.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the workflow.yml reproduction and the linked matrix-context documentation, focusing on the job-level if expression and its access to matrix.module. Verify whether the documented context availability matches the observed error. Done means the behavior is clarified and the workflow either works as expected or the documentation accurately describes the limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions
- Domain
- ci-cd
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100