Skip to content

Commit

Permalink
fix: Move target flags after target (#151)
Browse files Browse the repository at this point in the history
* move target flags after target

* fix: tests
  • Loading branch information
kukkok3 authored Jan 11, 2024
1 parent 23c3d7b commit 7a775d5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions actions/run/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion actions/run/src/run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: ''
},
Expand Down
9 changes: 5 additions & 4 deletions actions/run/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ export async function run(): Promise<void> {
args.push(...flags.split(' '))
}

if (targetFlags) {
args.push(...targetFlags.split(' '))
}

core.info(`Filtered targets >> ${targets}`)

targets.split(' ').map(tg => {
Expand All @@ -57,6 +53,11 @@ export async function run(): Promise<void> {
} 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)
Expand Down

0 comments on commit 7a775d5

Please sign in to comment.