@@ -16,6 +16,7 @@ Helper for parsing inputs in a GitHub Action
16
16
- Throws errors if input is set to [ required] ( #required-inputs ) and is missing
17
17
- Uses local environment variables (and ` .env ` files) during [ development] ( #development )
18
18
- Specify a [ custom function] ( #modify-the-parsed-input ) for advanced parsing
19
+ - Supports [ array of keys] ( #key )
19
20
20
21
## 🚀 Get started
21
22
@@ -83,13 +84,19 @@ Here are all the options you can use and there default values:
83
84
84
85
| Name | Description | Required | Default |
85
86
| ------------- | ------------- | ------------- | ------------- |
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 |
87
88
| `type` | The type of the input value (`string`/`boolean`/`number`/`array`) | **No** | `string` |
88
89
| `required` | Specify if the input is required | **No** | false |
89
90
| `default` | Specify a default value for the input | **No** | N/A |
90
91
| `disableable` | Specify if the input should be able to be disabled by setting it to `false` | **No** | `false` |
91
92
| `modifier` | A function which gets passed the parsed value as a parameter and returns another value | **No** | N/A |
92
93
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
+
93
100
# ## Types
94
101
95
102
You can specify one of the following types which will determine how the input is parsed :
@@ -246,6 +253,20 @@ const value = parser.getInput({
246
253
// Value will be undefined because labels was set to false
247
254
` ` `
248
255
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
+
249
270
# ## Modify the parsed input
250
271
251
272
Action Workflow :
0 commit comments