Skip to content

Commit a6c04ad

Browse files
validate codefresh run trigger args (#770)
* validate codefresh run trigger args * validate the options at command level, instead inside the logic it self * fix error msg * trigger
1 parent adb5c6c commit a6c04ad

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/interface/cli/commands/pipeline/run.cmd.js

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ const run = new Command({
2323
},
2424
builder: (yargs) => {
2525
yargs
26+
.check((argv) => {
27+
const { trigger, branch, sha } = argv;
28+
29+
if ((branch || sha) && !trigger) {
30+
throw new Error('Validation Error: --trigger is required when using --sha or --branch');
31+
}
32+
return true;
33+
})
2634
.option('trigger', {
2735
describe: 'Trigger id or name',
2836
alias: 't',

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.81.0",
3+
"version": "0.81.1",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)