Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 657

How to create github actions matrix using boolean input

$
0
0

I am trying to construct a strategy matrix for environments based on boolean selection for the environment but I am unable to construct it. How can I construct based on if Dev is selected or QA is selected or both?

name:  Build and Deploy on:  workflow_dispatch:    inputs:      Dev:        type: boolean        default: false        description: Dev      QA:        type: boolean        default: false        description: QA  push:    branches:      - id/githubActionsjobs:  prep_matrix:    runs-on: ubuntu-latest    outputs:      matrix: ${{steps.set-matrix.outputs.matrix}}    steps:      - id: set-matrix        run: |          Dev=${{github.event.inputs.Dev}}          QA=${{github.event.inputs.QA}}          matrix=$(jq --arg 'map(            . | select($Dev == "true") or ($QA == "true")          )' deployment_matrix.json )          echo "matrix={\"include\":$(echo $matrix)}" >> $GITHUB_OUTPUT`

I cannot construct the json matrix for Dev or QA.


Viewing all articles
Browse latest Browse all 657

Trending Articles