[GH-ISSUE #540] Enhancement: Support matrix builds with dynamic input #364

Closed
opened 2026-03-01 21:42:42 +03:00 by kerem · 1 comment
Owner

Originally created by @jonico on GitHub (Feb 22, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/540

Originally assigned to: @catthehacker on GitHub.

Describe feature

GitHub Actions has a neat feature to create a matrix dynamically based on the outputs of a previous job:


name: Dynamic Matrix build

on:
  workflow_dispatch:
    inputs:
          x:
            description: 'Number of jobs on x-Axis'
            required: true
            default: '8'
          y:
            description: 'Number of jobs on y-Axis'
            required: true
            default: '4'

jobs:
  generate-matrix:
    name: "Generate matrix job specs"
    outputs:
      x: ${{ steps.generate-matrix.outputs.x }}
      y: ${{ steps.generate-matrix.outputs.y }}
    runs-on: ubuntu-latest
    steps:
      - name: generate-matrix
        id: generate-matrix
        run: |
          echo "::set-output name=x::[`seq -s , ${{ github.event.inputs.x }}`]"
          echo "::set-output name=y::[`seq -s , ${{ github.event.inputs.y }}`]"

  matrix:
      name: "Matrix job"
      runs-on: ubuntu-latest
      needs: [generate-matrix]
  
      strategy:
        fail-fast: false
        matrix:
          x: ${{ fromJson(needs.generate-matrix.outputs.x) }}
          y: ${{ fromJson(needs.generate-matrix.outputs.y) }}
      steps:
            - name: Perform job
              run: echo "${{matrix.x}}, ${{matrix.y}}"

nektos/act currently does not understand the dynamic input for the matrix dimensions as already reported in #450 - and errors out even if there is just one workflow file in the repository that is using this feature:

$ act -l
Error: yaml: unmarshal errors:
  line 37: cannot unmarshal !!str `${{ fro...` into []interface {}
  line 38: cannot unmarshal !!str `${{ fro...` into []interface {}

It would be amazing if nektos/act would be able to support dynamic matrix builds as well - or at least does not error out if it finds a workflow file with that syntax.

Originally created by @jonico on GitHub (Feb 22, 2021). Original GitHub issue: https://github.com/nektos/act/issues/540 Originally assigned to: @catthehacker on GitHub. ## Describe feature GitHub Actions has a neat feature to [create a matrix dynamically](https://github.blog/changelog/2020-04-15-github-actions-new-workflow-features/) based on the outputs of a previous job: ```yaml name: Dynamic Matrix build on: workflow_dispatch: inputs: x: description: 'Number of jobs on x-Axis' required: true default: '8' y: description: 'Number of jobs on y-Axis' required: true default: '4' jobs: generate-matrix: name: "Generate matrix job specs" outputs: x: ${{ steps.generate-matrix.outputs.x }} y: ${{ steps.generate-matrix.outputs.y }} runs-on: ubuntu-latest steps: - name: generate-matrix id: generate-matrix run: | echo "::set-output name=x::[`seq -s , ${{ github.event.inputs.x }}`]" echo "::set-output name=y::[`seq -s , ${{ github.event.inputs.y }}`]" matrix: name: "Matrix job" runs-on: ubuntu-latest needs: [generate-matrix] strategy: fail-fast: false matrix: x: ${{ fromJson(needs.generate-matrix.outputs.x) }} y: ${{ fromJson(needs.generate-matrix.outputs.y) }} steps: - name: Perform job run: echo "${{matrix.x}}, ${{matrix.y}}" ``` `nektos/act` currently does not understand the dynamic input for the matrix dimensions as already reported in #450 - and errors out even if there is just one workflow file in the repository that is using this feature: ```bash $ act -l Error: yaml: unmarshal errors: line 37: cannot unmarshal !!str `${{ fro...` into []interface {} line 38: cannot unmarshal !!str `${{ fro...` into []interface {} ``` It would be amazing if `nektos/act` would be able to support dynamic matrix builds as well - or at least does not error out if it finds a workflow file with that syntax.
Author
Owner

@github-actions[bot] commented on GitHub (Mar 24, 2021):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:805373219 --> @github-actions[bot] commented on GitHub (Mar 24, 2021): Issue is stale and will be closed in 14 days unless there is new activity
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#364
No description provided.