Open
Description
Is your feature request related to a problem? Please describe.
I'm using a matrix and I want to access matrix- and strategy-related variables in my github-script. The two ways to do that are:
- Setting env vars:
# ...
strategy:
matrix:
group: [1, 2]
steps:
- uses: actions/github-script@v7
env:
MATRIX_GROUP: ${{ matrix.group }}
MATRIX_NUM_GROUPS: ${{ strategy.job-total }}
with:
script: |
const group = parseInt(process.env.MATRIX_GROUP)
const numGroups = parseInt(process.env.MATRIX_NUM_GROUPS)
- Interpolation:
# ...
strategy:
matrix:
group: [1, 2]
steps:
- uses: actions/github-script@v7
with:
script: |
const group = ${{ matrix.group }}
const numGroups = ${{ strategy.job-total }}
Describe the solution you'd like
It would be nice if these were offered somewhere in the context
object, which seems like an intuitive home for them. Something like...
# ...
strategy:
matrix:
group: [1, 2]
steps:
- uses: actions/github-script@v7
with:
script: |
const group = parseInt(context.strategy.matrix.group)
const numGroups = context.strategy.totalJobs
Metadata
Metadata
Assignees
Labels
No labels