Skip to content

array outputs not understood by matrix when nested inside object #3794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
CamJN opened this issue Apr 7, 2025 · 1 comment
Open

array outputs not understood by matrix when nested inside object #3794

CamJN opened this issue Apr 7, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@CamJN
Copy link

CamJN commented Apr 7, 2025

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 �[36;1mecho 'debs=["focal", "jammy", "noble", "plucky", "bullseye", "bookworm"]' >> "$GITHUB_OUTPUT"�[0m
2025-04-07T20:08:00.4273296Z �[36;1mecho 'rpms=["el8", "el9"]' >> "$GITHUB_OUTPUT"�[0m
2025-04-07T20:08:00.4273886Z �[36;1mcat "$GITHUB_OUTPUT"�[0m
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.

@CamJN CamJN added the bug Something isn't working label Apr 7, 2025
@CamJN
Copy link
Author

CamJN commented Apr 7, 2025

I should add that I use this approach successfully when I'm not trying to include an array into the matrix as part of an object: https://github.com/phusion/passenger_apt_automation/actions/runs/14203546100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant