Skip to content

Commit 3789a9a

Browse files
encXpdujtipiya
and
pdujtipiya
authored
Skip vcs checking if dryrun is true (#162)
Co-authored-by: pdujtipiya <[email protected]>
1 parent 05a9e89 commit 3789a9a

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/Config/Config.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,6 @@ const args = yargs
4747
.group(['vcs', 'buildLogFile', 'output', 'removeOldComment'], 'Parsing options:')
4848
.group(GITLAB_ARGS, 'GitLab options:')
4949
.group(GITHUB_ARGS, 'GitHub options:')
50-
.check((options) => {
51-
// validate VCS configs
52-
if (options.vcs === 'github' && GITHUB_ARGS.some((arg) => !options[arg]))
53-
throw `GitHub requires [${GITHUB_ARGS.map((a) => `--${a}`).join(', ')}] to be set`;
54-
55-
if (options.vcs === 'gitlab' && GITLAB_ARGS.some((arg) => !options[arg]))
56-
throw `GitLab requires [${GITLAB_ARGS.map((a) => `--${a}`).join(', ')}] to be set`;
57-
58-
return true;
59-
})
6050
.option('buildLogFile', {
6151
alias: 'f',
6252
describe: `Build log content files formatted in '<type>;<path>[;<cwd>]'
@@ -128,7 +118,14 @@ and <cwd> is build root directory (optional (Will use current context as cwd)).
128118
})
129119
.check((options) => {
130120
if (options.dryRun) return true;
121+
122+
// validate VCS configs
131123
if (typeof options.vcs === 'undefined') throw 'VCS type is required';
124+
if (options.vcs === 'github' && GITHUB_ARGS.some((arg) => !options[arg]))
125+
throw `GitHub requires [${GITHUB_ARGS.map((a) => `--${a}`).join(', ')}] to be set`;
126+
if (options.vcs === 'gitlab' && GITLAB_ARGS.some((arg) => !options[arg]))
127+
throw `GitLab requires [${GITLAB_ARGS.map((a) => `--${a}`).join(', ')}] to be set`;
128+
132129
return true;
133130
})
134131
.strict()

0 commit comments

Comments
 (0)