Skip to content

Commit bc7588b

Browse files
committed
Fix run-validations.js
1 parent a1d1fb5 commit bc7588b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

compiler/run-validations.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async function run () {
6464
const isStale = lastRun.getTime() + DAY < Date.now()
6565

6666
if (typeof argv.api !== 'string') {
67-
spinner.fail('You must specify the api, for example: \'make validate api=index type=request stack-version=8.1.0-SNAPSHOT\'')
67+
spinner.fail('You must specify the api, for example: \'make validate api=index type=request branch=main\'')
6868
process.exit(1)
6969
}
7070

@@ -75,15 +75,16 @@ async function run () {
7575

7676
// if true it's because the make target wasn't configured with a type argument
7777
if (argv.type !== true && argv.type !== 'request' && argv.type !== 'response') {
78-
spinner.fail('You must specify the type (request or response), for example: \'make validate api=index type=request stack-version=8.1.0-SNAPSHOT\'')
78+
spinner.fail('You must specify the type (request or response), for example: \'make validate api=index type=request branch=main\'')
7979
process.exit(1)
8080
}
8181

82-
if (typeof argv['stack-version'] !== 'string') {
83-
spinner.fail('You must specify the stack version, for example: \'make validate api=index type=request stack-version=8.1.0-SNAPSHOT\'')
82+
if (typeof argv.branch !== 'string' && typeof argv.branch !== 'number') {
83+
spinner.fail('You must specify the branch, for example: \'make validate api=index type=request branch=main\'')
8484
process.exit(1)
8585
}
8686

87+
8788
const isFlightRecorderCloned = await $`[[ -d ${path.join(__dirname, '..', '..', 'clients-flight-recorder')} ]]`.exitCode === 0
8889
if (!isFlightRecorderCloned) {
8990
spinner.text = 'It looks like you didn\'t cloned the flight recorder, doing that for you'
@@ -165,7 +166,8 @@ async function run () {
165166

166167
spinner.text = 'Running validations'
167168

168-
const branchName = argv['branch'].startsWith('7.') ? '7.x' : argv['branch']
169+
const branchArg = argv.branchArg.toString()
170+
const branchName = branchArg.startsWith('7.') ? '7.x' : branchArg
169171

170172
if (noCache || isStale || metadata.branchName !== branchName) {
171173
metadata.lastRun = new Date()
@@ -188,7 +190,7 @@ async function run () {
188190
} else {
189191
flags.push(`--${argv.type}`)
190192
}
191-
const output = await $`STACK_VERSION=${argv['stack-version']} node ${path.join(tsValidationPath, 'index.js')} --api ${argv.api} ${flags}`
193+
const output = await $`node ${path.join(tsValidationPath, 'index.js')} --api ${argv.api} --branch ${branchName} ${flags}`
192194

193195
cd(path.join(compilerPath, '..'))
194196
if (output.exitCode === 0) {

0 commit comments

Comments
 (0)