Skip to content

Commit ccb0550

Browse files
authored
docs: add examples of input arrays. (EndBug#645)
Having to wrap it all as a string is a bit strange, and an example helps. I don't actually think the `JSON.parse` is needed, because the YAML flow sequence syntax handles that case too: https://yaml.org/spec/1.2.2/#741-flow-sequences
1 parent a82018e commit ccb0550

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,29 @@ You can also use the `committer_name` and `committer_email` inputs to make it ap
255255
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
256256
```
257257

258+
### Array inputs
259+
260+
Due to limitations in the GitHub action APIs, all inputs must be either strings or booleans.
261+
The action supports arrays in `add` and `remove`, but they have to be encoded as a string with a YAML flow sequence:
262+
263+
```yaml
264+
- uses: EndBug/add-and-commit@v9
265+
with:
266+
add: '["afile.txt", "anotherfile.txt"]'
267+
```
268+
269+
(note the single-quotes) or a YAML block sequence:
270+
271+
```yaml
272+
- uses: EndBug/add-and-commit@v9
273+
with:
274+
add: |
275+
- afile.txt
276+
- anotherfile.txt
277+
```
278+
279+
(Note the pipe character making it a multiline string.)
280+
258281
### Automated linting
259282

260283
Do you want to lint your JavaScript files, located in the `src` folder, with ESLint, so that fixable changes are done without your intervention? You can use a workflow like this:

0 commit comments

Comments
 (0)