Skip to content

Commit 2963858

Browse files
committed
Update descriptions
1 parent 601641d commit 2963858

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

README.md

+54
Original file line numberDiff line numberDiff line change
@@ -1 +1,55 @@
11
# json-array-builder
2+
3+
![test](https://github.com/kanga333/json-array-builder/workflows/test/badge.svg)
4+
5+
The `kanga333/json-array-builder` action is a TypeScript action that helps you to build JSON array to be used in dynamic matrix job.
6+
7+
## Examples
8+
9+
This workflow decides the parameter to be used in the dynamic matrix at the job of `matrix_input`.
10+
After that, `dynamic_matrix` runs jobs in parallel based on the parameters passed to it.
11+
12+
```yaml
13+
name: 'example'
14+
on:
15+
pull_request:
16+
push:
17+
branches:
18+
- main
19+
jobs:
20+
matrix_input:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: kanga333/json-array-builder@master
25+
id: array
26+
with:
27+
# Using this repository as an example, the output of the command is
28+
# builder.ts
29+
# execer.ts
30+
# main.ts
31+
cmd: ls src
32+
separator: newline
33+
outputs:
34+
param: ${{ steps.array.outputs.build }}
35+
dynamic_matrix:
36+
needs:
37+
- matrix_input
38+
strategy:
39+
matrix:
40+
# Three matrix jobs work, builder.ts, execer.ts. main.ts
41+
param: ${{ fromJson(needs.matrix_input.outputs.param) }}
42+
runs-on: ubuntu-latest
43+
steps:
44+
- run: |
45+
echo ${{ matrix.param }}
46+
```
47+
48+
## Inputs
49+
50+
| name | description | default |
51+
| ---- | ---- | ---- |
52+
| str | String to split by separator to build JSON array. str cannot be used with cmd at the same time. | |
53+
| 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. | |
54+
| 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 |
55+
| json_array | If given JSON array string, this action appends to it. | |

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'json-array-builder'
2-
description: 'Build JSON array from string'
2+
description: 'Build JSON array to be used in dynamic matrix job'
33
author: 'kanga333'
44
inputs:
55
str:

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
},
2020
"keywords": [
2121
"actions",
22-
"node",
23-
"setup"
22+
"json"
2423
],
2524
"author": "",
2625
"license": "MIT",

0 commit comments

Comments
 (0)