Skip to content

Define a list of elements in a variable #46785

Answered by ChristopherHX
gforcada asked this question in Actions
Discussion options

You must be logged in to vote

You can use fromJSON to parse your variable (json array) into an Array object for the matrix.

...
jobs:
  test:
    strategy:
      matrix:
        os: ${{ fromJSON(vars.TEST_OS_VERSIONS) }}
...

You may run into issues with pull_request workflows, because vars.TEST_OS_VERSIONS might currently end up undefined.

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
4 replies
@gforcada
Comment options

@SilasRodrigues19
Comment options

@gforcada
Comment options

@brianjmurrell
Comment options

Comment options

You must be logged in to vote
6 replies
@SergkeiM
Comment options

@gforcada
Comment options

@SergkeiM
Comment options

@ChristopherHX
Comment options

@SergkeiM
Comment options

Answer selected by gforcada
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question
5 participants