The kanga333/json-array-builder action is a TypeScript action that helps you to build JSON array to be used in dynamic matrix job.
This workflow decides the parameter to be used in the dynamic matrix at the job of matrix_input.
After that, dynamic_matrix runs jobs in parallel based on the parameters passed to it.
name: 'example'on:
pull_request:
push:
branches:
- mainjobs:
matrix_input:
runs-on: ubuntu-lateststeps:
- uses: actions/checkout@v2
- uses: kanga333/json-array-builder@mainid: arraywith:
# Using this repository as an example, the output of the command is# builder.ts# execer.ts# main.tscmd: ls srcseparator: newlineoutputs:
param: ${{ steps.array.outputs.build }}dynamic_matrix:
needs:
- matrix_inputstrategy:
matrix:
# Three matrix jobs work, builder.ts, execer.ts. main.tsparam: ${{ fromJson(needs.matrix_input.outputs.param) }}runs-on: ubuntu-lateststeps:
- run: | echo ${{ matrix.param }}| name | description | default |
|---|---|---|
| str | String to split by separator to build JSON array. str cannot be used with cmd at the same time. | |
| cmd | Execute the given command and use the stdout to split by separator to build JSON array. str cannot be used with cmd at the same time. | |
| separator | String to separate a given input. If you need to separate by '\n', please specify the value as 'newline'. Also, if you need to separate by ' ', please specify the value as 'space'. | newline |
| json_array | If given JSON array string, this action appends to it. |