-
Notifications
You must be signed in to change notification settings - Fork 34
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
Support arrays #63
Comments
@mrmeyers99 Thank you for your report. Unfortunately, the output of Github Actions supports only string type. So, we can't export the output as an array. However, If we support export value as a JSON string, is it helpful for you? It will be able to use like below. determine-regions:
outputs:
regions: ${{ steps.export.outputs.regions }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: var-map
run: |
echo ::set-output name=content::$(cat ./.github/env_vars.json)
- uses: kanga333/variable-mapper@master
id: export
with:
key: "${{ github.event.inputs.environment }}"
map: |
{
"production": {
"regions": ["us-east-1", "us-west-2"]
},
"uat": {
"regions": ["us-east-1", "us-west-2"]
}
}
export_to: log,output
# Flag to serialize map value as a JSON string
serialize_json: true
deploy:
environment: ${{ github.event.inputs.environment }}
needs: [ determine-regions ]
runs-on: ubuntu-latest
strategy:
matrix:
# using with fromJson, because outputs value is JSON string.
region: ${{ fromJson(needs.determine-regions.outputs.regions) }}
stack: [a, b, c]
fail-fast: true
max-parallel: 1 In this example, variable-mapper outputs the serialized JSON string |
Yeah that would work, thanks! |
It would be nice if this supported arrays so that we could plugin the array as a matrix variable. Not sure if this is supported by Github Actions though. I'm thinking something like this:
where the
env_vars.json
looks like this:I guess the work around is to encode the JSON array in the string and then use the
toJson
function github provides, but it would be nice to not have to do that.The text was updated successfully, but these errors were encountered: