Skip to content

Commit

Permalink
validate codefresh run trigger args (#770)
Browse files Browse the repository at this point in the history
* validate codefresh run trigger args

* validate the options at command level, instead inside the logic it self

* fix error msg

* trigger
  • Loading branch information
kim-codefresh authored Dec 12, 2022
1 parent adb5c6c commit a6c04ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/interface/cli/commands/pipeline/run.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ const run = new Command({
},
builder: (yargs) => {
yargs
.check((argv) => {
const { trigger, branch, sha } = argv;

if ((branch || sha) && !trigger) {
throw new Error('Validation Error: --trigger is required when using --sha or --branch');
}
return true;
})
.option('trigger', {
describe: 'Trigger id or name',
alias: 't',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codefresh",
"version": "0.81.0",
"version": "0.81.1",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down

0 comments on commit a6c04ad

Please sign in to comment.