Skip to content

Commit d0a23b7

Browse files
authored
Merge pull request #88 from kddejong/feature/parameters/commalisttest
Support comma delimited lists for parameter overrides
2 parents 87a972c + 3f22dbe commit d0a23b7

File tree

6 files changed

+1943
-1361
lines changed

6 files changed

+1943
-1361
lines changed

.github/workflows/check.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
on: [pull_request]
1+
on:
2+
push:
3+
branches: [ master ]
4+
pull_request:
5+
branches: [ master ]
26

37
name: Check
48

@@ -7,8 +11,11 @@ jobs:
711
name: Run Unit Tests
812
runs-on: ubuntu-latest
913
steps:
10-
- name: Checkout
11-
uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
15+
- name: Use Node.js 16.x
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 16.x
1219
- name: Run tests
1320
run: |
1421
npm ci

__tests__/utils.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,38 @@ describe('Parse Parameters', () => {
7272
])
7373
})
7474

75+
test('returns parameters list with an extra equal', async () => {
76+
const json = parseParameters(
77+
'MyParam1=myValue1,MyParam2=myValue2=myValue3,MyParam2=myValue4'
78+
)
79+
expect(json).toEqual([
80+
{
81+
ParameterKey: 'MyParam1',
82+
ParameterValue: 'myValue1'
83+
},
84+
{
85+
ParameterKey: 'MyParam2',
86+
ParameterValue: 'myValue2=myValue3,myValue4'
87+
}
88+
])
89+
})
90+
91+
test('returns parameters list from multiple lists with quotes', async () => {
92+
const json = parseParameters(
93+
'MyParam1=myValue1,MyParam2="myValue2,myValue3",MyParam2=myValue4'
94+
)
95+
expect(json).toEqual([
96+
{
97+
ParameterKey: 'MyParam1',
98+
ParameterValue: 'myValue1'
99+
},
100+
{
101+
ParameterKey: 'MyParam2',
102+
ParameterValue: 'myValue2,myValue3,myValue4'
103+
}
104+
])
105+
})
106+
75107
test('returns parameters list from file', async () => {
76108
const filename = 'file://' + path.join(__dirname, 'params.test.json')
77109
const json = parseParameters(filename)

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ inputs:
1515
required: false
1616
default: "CAPABILITY_IAM"
1717
parameter-overrides:
18-
description: 'The parameters to override in the stack inputs. You can pass a comma-delimited list or a file URL. Comma-delimited list has each entry formatted as <ParameterName>=<ParameterValue>. A JSON file can be a local file with a "file://" prefix or remote URL (e.g. file:///${{ github.workspace }}/variables.json or http://example.com/variables.json). A local file needs to be specified with an absolute path to it. The file should look like: [ { "ParameterKey": "KeyPairName", "ParameterValue": "MyKey" }]'
18+
description: 'The parameters to override in the stack inputs. You can pass a comma-delimited list or a file URL. Comma-delimited list has each entry formatted as <ParameterName>=<ParameterValue> or <ParameterName>="<ParameterValue>,<ParameterValue>". A JSON file can be a local file with a "file://" prefix or remote URL (e.g. file:///${{ github.workspace }}/variables.json or http://example.com/variables.json). A local file needs to be specified with an absolute path to it. The file should look like: [ { "ParameterKey": "KeyPairName", "ParameterValue": "MyKey" }]'
1919
required: false
2020
no-execute-changeset:
2121
description: "Indicates whether to execute to the change set or have it reviewed. Default to '0' (will execute the change set)"

dist/index.js

Lines changed: 12 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)