actions / actions/runner

array outputs not understood by matrix when nested inside object

Open
#3,794 3 comments 0 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
I cannot use an output as part of a matrix if the matrix is an object.

To Reproduce
Steps to reproduce the behavior:

  1. Create the following workflow file:
  2. Run it
  3. observe that the array is inlined as the word Array in use-matrix-type-1 and the array is inlined as plain string in use-matrix-type-2.
name: Debug

defaults:
  run:
    shell: bash

on:
  workflow_dispatch

jobs:

  define-matrix:
    runs-on: ubuntu-latest
    outputs:
      rpms: ${{ steps.distros.outputs.rpms }}
      debs: ${{ steps.distros.outputs.debs }}
    steps:
      - id: distros
        run: |
          echo 'debs=["focal", "jammy", "noble", "plucky", "bullseye", "bookworm"]' >> "$GITHUB_OUTPUT"
          echo 'rpms=["el8", "el9"]' >> "$GITHUB_OUTPUT"
          cat "$GITHUB_OUTPUT"

  debug:
    runs-on: ubuntu-latest
    needs: [ define-matrix ]
    steps:
      - run: |
          echo '${{ needs.define-matrix.outputs.debs }}'
          echo '${{ needs.define-matrix.outputs.rpms }}'
          echo '${{ fromJSON(needs.define-matrix.outputs.debs) }}'
          echo '${{ fromJSON(needs.define-matrix.outputs.rpms) }}'

  use-matrix-type-1:
    runs-on: ${{ matrix.arch.runner }}
    needs: [ define-matrix ]
    strategy:
      matrix:
        arch:
          - name: x86_64
            runner: ubuntu-24.04
          - name: aarch64
            runner: ubuntu-24.04-arm
        component:
          - name: rhel
            distro: ${{ fromJSON(needs.define-matrix.outputs.rpms) }}
          - name: debian
            distro: ${{ fromJSON(needs.define-matrix.outputs.debs) }}
    steps:
      - run: echo ${{ matrix.component.name }} ${{ matrix.component.distro }}

  use-matrix-type-2:
    runs-on: ${{ matrix.arch.runner }}
    needs: [ define-matrix ]
    strategy:
      matrix:
        arch:
          - name: x86_64
            runner: ubuntu-24.04
          - name: aarch64
            runner: ubuntu-24.04-arm
        component:
          - name: rhel
            distro: ${{ needs.define-matrix.outputs.rpms }}
          - name: debian
            distro: ${{ needs.define-matrix.outputs.debs }}
    steps:
      - run: echo ${{ matrix.component.name }} ${{ matrix.component.distro }}

Expected behavior
I expect the array to be inlined as an array so that the matrix runs the job for each distro in the array.

Runner Version and Platform

Current runner version: '2.323.0'
Operating System
  Ubuntu
  24.04.2
  LTS
Runner Image
  Image: ubuntu-24.04
  Version: 20250406.1.0
  Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250406.1/images/ubuntu/Ubuntu2404-Readme.md
  Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250406.1

What's not working?

The array is inlined as the word Array in the use-matrix-type-1 job and the array is inlined as plain string in the use-matrix-type-2 job.

Job Log Output

2025-04-07T20:08:00.3009028Z Current runner version: '2.323.0'
2025-04-07T20:08:00.3033356Z ##[group]Operating System
2025-04-07T20:08:00.3034143Z Ubuntu
2025-04-07T20:08:00.3034703Z 24.04.2
2025-04-07T20:08:00.3035226Z LTS
2025-04-07T20:08:00.3035704Z ##[endgroup]
2025-04-07T20:08:00.3036451Z ##[group]Runner Image
2025-04-07T20:08:00.3037097Z Image: ubuntu-24.04
2025-04-07T20:08:00.3037626Z Version: 20250406.1.0
2025-04-07T20:08:00.3038693Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250406.1/images/ubuntu/Ubuntu2404-Readme.md
2025-04-07T20:08:00.3040098Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250406.1
2025-04-07T20:08:00.3041011Z ##[endgroup]
2025-04-07T20:08:00.3041608Z ##[group]Runner Image Provisioner
2025-04-07T20:08:00.3042216Z 2.0.422.1
2025-04-07T20:08:00.3042666Z ##[endgroup]
2025-04-07T20:08:00.3045079Z ##[group]GITHUB_TOKEN Permissions
2025-04-07T20:08:00.3047678Z Actions: write
2025-04-07T20:08:00.3048515Z Attestations: write
2025-04-07T20:08:00.3049117Z Checks: write
2025-04-07T20:08:00.3049712Z Contents: write
2025-04-07T20:08:00.3050260Z Deployments: write
2025-04-07T20:08:00.3050817Z Discussions: write
2025-04-07T20:08:00.3051322Z Issues: write
2025-04-07T20:08:00.3051834Z Metadata: read
2025-04-07T20:08:00.3052365Z Models: read
2025-04-07T20:08:00.3052906Z Packages: write
2025-04-07T20:08:00.3053715Z Pages: write
2025-04-07T20:08:00.3054254Z PullRequests: write
2025-04-07T20:08:00.3054857Z RepositoryProjects: write
2025-04-07T20:08:00.3055436Z SecurityEvents: write
2025-04-07T20:08:00.3056075Z Statuses: write
2025-04-07T20:08:00.3057012Z ##[endgroup]
2025-04-07T20:08:00.3060056Z Secret source: Actions
2025-04-07T20:08:00.3061211Z Prepare workflow directory
2025-04-07T20:08:00.3433340Z Prepare all required actions
2025-04-07T20:08:00.3484450Z Complete job name: define-matrix
2025-04-07T20:08:00.4271205Z ##[group]Run echo 'debs=["focal", "jammy", "noble", "plucky", "bullseye", "bookworm"]' >> "$GITHUB_OUTPUT"
2025-04-07T20:08:00.4272398Z echo 'debs=["focal", "jammy", "noble", "plucky", "bullseye", "bookworm"]' >> "$GITHUB_OUTPUT"
2025-04-07T20:08:00.4273296Z echo 'rpms=["el8", "el9"]' >> "$GITHUB_OUTPUT"
2025-04-07T20:08:00.4273886Z cat "$GITHUB_OUTPUT"
2025-04-07T20:08:00.4627343Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2025-04-07T20:08:00.4628390Z ##[endgroup]
2025-04-07T20:08:00.4879122Z debs=["focal", "jammy", "noble", "plucky", "bullseye", "bookworm"]
2025-04-07T20:08:00.4879872Z rpms=["el8", "el9"]
2025-04-07T20:08:00.4990212Z Evaluate and set job outputs
2025-04-07T20:08:00.5024999Z Set output 'rpms'
2025-04-07T20:08:00.5027468Z Set output 'debs'
2025-04-07T20:08:00.5028452Z Cleaning up orphan processes

Runner and Worker's Diagnostic Logs

I'm not sure if this info would be helpful.

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 with the matrix expressions in the supplied workflow, especially fromJSON outputs nested under matrix.component, and compare them with the logged results from the two example jobs. Trace how the runner evaluates nested matrix values and job outputs; done means arrays remain arrays and the workflow creates one matrix job for each distro.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, github-actions
Domain
ci-cd, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.