diff --git a/dist/action.mjs b/dist/action.mjs index 6d7b23e..8737a2a 100644 --- a/dist/action.mjs +++ b/dist/action.mjs @@ -382,9 +382,7 @@ function getContext() { configure: { generator: getInput("generator"), options, - args: getInput("args") - .split(/\s+/) - .filter((arg) => arg != ""), + args: shellQuoteExports.parse(getInput("args")).map((arg) => arg.toString()), }, build: { enabled: getInput("run-build") == "true", diff --git a/src/context.test.ts b/src/context.test.ts index e499a02..394bd7a 100644 --- a/src/context.test.ts +++ b/src/context.test.ts @@ -116,12 +116,12 @@ describe("get action context", () => { }, { name: "with additional arguments specified", - inputs: { args: "-Wdev -Wdeprecated\n--fresh" }, + inputs: { args: `-Wdev -Wdeprecated\n--fresh --foo "bar baz"` }, expectedContext: { configure: { generator: "", options: [], - args: ["-Wdev", "-Wdeprecated", "--fresh"], + args: ["-Wdev", "-Wdeprecated", "--fresh", "--foo", "bar baz"], }, }, }, @@ -151,7 +151,7 @@ describe("get action context", () => { "c-flags": "-Werror -Wall\n-Wextra", "cxx-flags": "-Werror -Wall\n-Wextra -Wpedantic", options: `BUILD_TESTING=ON BUILD_EXAMPLES=ON\nBUILD_DOCS=ON FOO="BAR BAZ"`, - args: "-Wdev -Wdeprecated\n--fresh", + args: `-Wdev -Wdeprecated\n--fresh --foo "bar baz"`, "run-build": "true", "build-args": "--target foo\n--parallel 8", }, @@ -170,7 +170,7 @@ describe("get action context", () => { "BUILD_DOCS=ON", "FOO=BAR BAZ", ], - args: ["-Wdev", "-Wdeprecated", "--fresh"], + args: ["-Wdev", "-Wdeprecated", "--fresh", "--foo", "bar baz"], }, build: { enabled: true, diff --git a/src/context.ts b/src/context.ts index 10f731e..9f4161b 100644 --- a/src/context.ts +++ b/src/context.ts @@ -49,9 +49,7 @@ export function getContext(): Context { configure: { generator: getInput("generator"), options, - args: getInput("args") - .split(/\s+/) - .filter((arg) => arg != ""), + args: parse(getInput("args")).map((arg) => arg.toString()), }, build: { enabled: getInput("run-build") == "true",