Skip to content

Commit 8c0edbc

Browse files
authored
Merge pull request #175 from crazy-max/input-list-quotes
escape surrounding quotes for platforms input
2 parents 693fdd6 + 1fb9cbd commit 8c0edbc

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

__tests__/context.test.ts

+15
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,21 @@ describe('getCreateArgs', () => {
124124
'--buildkitd-flags', '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host'
125125
]
126126
],
127+
[
128+
6,
129+
new Map<string, string>([
130+
['install', 'false'],
131+
['use', 'false'],
132+
['platforms', 'linux/amd64\n"linux/arm64,linux/arm/v7"'],
133+
]),
134+
[
135+
'create',
136+
'--name', 'builder-9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d',
137+
'--driver', 'docker-container',
138+
'--buildkitd-flags', '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
139+
'--platform', 'linux/amd64,linux/arm64,linux/arm/v7'
140+
]
141+
],
127142
])(
128143
'[%d] given %p as inputs, returns %p',
129144
async (num: number, inputs: Map<string, string>, expected: Array<string>) => {

dist/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/context.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export async function getInputs(): Promise<Inputs> {
4545
driver: core.getInput('driver') || 'docker-container',
4646
driverOpts: await getInputList('driver-opts', true),
4747
buildkitdFlags: core.getInput('buildkitd-flags') || '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
48-
platforms: await getInputList('platforms'),
48+
platforms: await getInputList('platforms', false, true),
4949
install: core.getBooleanInput('install'),
5050
use: core.getBooleanInput('use'),
5151
endpoint: core.getInput('endpoint'),
@@ -118,7 +118,7 @@ export async function getInspectArgs(inputs: Inputs, buildxVersion: string): Pro
118118
return args;
119119
}
120120

121-
export async function getInputList(name: string, ignoreComma?: boolean): Promise<string[]> {
121+
export async function getInputList(name: string, ignoreComma?: boolean, escapeQuotes?: boolean): Promise<string[]> {
122122
const res: Array<string> = [];
123123

124124
const items = core.getInput(name);
@@ -132,7 +132,7 @@ export async function getInputList(name: string, ignoreComma?: boolean): Promise
132132
comment: '#',
133133
relaxColumnCount: true,
134134
skipEmptyLines: true,
135-
quote: false
135+
quote: escapeQuotes ? `"` : false
136136
});
137137

138138
for (const record of records as Array<string[]>) {

0 commit comments

Comments
 (0)