Skip to content

Commit

Permalink
docs: add examples of input arrays. (#645)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tommie authored Jun 28, 2024
1 parent a82018e commit ccb0550
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,29 @@ You can also use the `committer_name` and `committer_email` inputs to make it ap
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
```

### Array inputs

Due to limitations in the GitHub action APIs, all inputs must be either strings or booleans.
The action supports arrays in `add` and `remove`, but they have to be encoded as a string with a YAML flow sequence:

```yaml
- uses: EndBug/add-and-commit@v9
with:
add: '["afile.txt", "anotherfile.txt"]'
```

(note the single-quotes) or a YAML block sequence:

```yaml
- uses: EndBug/add-and-commit@v9
with:
add: |
- afile.txt
- anotherfile.txt
```

(Note the pipe character making it a multiline string.)

### Automated linting

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:
Expand Down

0 comments on commit ccb0550

Please sign in to comment.