@@ -16,6 +16,7 @@ Helper for parsing inputs in a GitHub Action
1616- Throws errors if input is set to [ required] ( #required-inputs ) and is missing
1717- Uses local environment variables (and ` .env ` files) during [ development] ( #development )
1818- Specify a [ custom function] ( #modify-the-parsed-input ) for advanced parsing
19+ - Supports [ array of keys] ( #key )
1920
2021## 🚀 Get started
2122
@@ -83,13 +84,19 @@ Here are all the options you can use and there default values:
8384
8485| Name | Description | Required | Default |
8586| ------------- | ------------- | ------------- | ------------- |
86- | `key` | The key of the input option | **Yes** | N/A |
87+ | `key` | The key of the input option (can also be an array of keys) | **Yes** | N/A |
8788| `type` | The type of the input value (`string`/`boolean`/`number`/`array`) | **No** | `string` |
8889| `required` | Specify if the input is required | **No** | false |
8990| `default` | Specify a default value for the input | **No** | N/A |
9091| `disableable` | Specify if the input should be able to be disabled by setting it to `false` | **No** | `false` |
9192| `modifier` | A function which gets passed the parsed value as a parameter and returns another value | **No** | N/A |
9293
94+ # ## Key
95+
96+ You can either specify a single key as a string, or multiple keys as an array of strings.
97+
98+ [See example](#multiple-keys)
99+
93100# ## Types
94101
95102You can specify one of the following types which will determine how the input is parsed :
@@ -246,6 +253,20 @@ const value = parser.getInput({
246253// Value will be undefined because labels was set to false
247254` ` `
248255
256+ # ## Multiple Keys
257+
258+ Action code :
259+
260+ ` ` ` js
261+ const parser = require('action-input-parser')
262+
263+ const value = parser.getInput({
264+ key: [ 'GITHUB_TOKEN', 'GH_PAT' ]
265+ })
266+
267+ // The first key takes precedence
268+ ` ` `
269+
249270# ## Modify the parsed input
250271
251272Action Workflow :
0 commit comments