diff --git a/actions/run/dist/index.js b/actions/run/dist/index.js index 6c582801a..1c1011b9e 100644 --- a/actions/run/dist/index.js +++ b/actions/run/dist/index.js @@ -2902,9 +2902,6 @@ async function run() { if (flags) { args.push(...flags.split(' ')); } - if (targetFlags) { - args.push(...targetFlags.split(' ')); - } core.info(`Filtered targets >> ${targets}`); targets.split(' ').map(tg => { // Get the filtered targets associated with the pattern target and earthfile. @@ -2923,6 +2920,9 @@ async function run() { else { argsSpawn.push(t); } + if (targetFlags) { + argsSpawn.push(...targetFlags.split(' ')); + } core.info(`Running command: ${command} ${argsSpawn.join(' ')}`); const output = await spawnCommand(command, argsSpawn); const imageOutput = parseImage(output); diff --git a/actions/run/src/run.test.ts b/actions/run/src/run.test.ts index 64fd351ec..efe506f75 100644 --- a/actions/run/src/run.test.ts +++ b/actions/run/src/run.test.ts @@ -33,7 +33,7 @@ describe('Run Action', () => { runnerPort: '', targets: 'target', targetFlags: '--flag1 test -f2 test2', - command: [['--flag1', 'test', '-f2', 'test2', './earthfile+target']], + command: [['./earthfile+target', '--flag1', 'test', '-f2', 'test2']], imageOutput: '', artifactOutput: '' }, diff --git a/actions/run/src/run.ts b/actions/run/src/run.ts index 0b2d3e11d..82960d75f 100644 --- a/actions/run/src/run.ts +++ b/actions/run/src/run.ts @@ -34,10 +34,6 @@ export async function run(): Promise { args.push(...flags.split(' ')) } - if (targetFlags) { - args.push(...targetFlags.split(' ')) - } - core.info(`Filtered targets >> ${targets}`) targets.split(' ').map(tg => { @@ -57,6 +53,11 @@ export async function run(): Promise { } else { argsSpawn.push(t) } + + if (targetFlags) { + argsSpawn.push(...targetFlags.split(' ')) + } + core.info(`Running command: ${command} ${argsSpawn.join(' ')}`) const output = await spawnCommand(command, argsSpawn) const imageOutput = parseImage(output)