@@ -3,7 +3,12 @@ process.env.RUN_MODE = 'cli'
33
44import yargs from 'yargs/yargs'
55import { hideBin } from 'yargs/helpers'
6- import { exitActionOnFail , getAllGitHubContext , handleError } from '../github'
6+ import {
7+ exitActionOnFail ,
8+ exitActionOnEmpty ,
9+ getAllGitHubContext ,
10+ handleError
11+ } from '../github'
712import { prepareReport } from '../ctrf'
813import { handleViewsAndComments , handleAnnotations } from '../github/handler'
914import { getCliInputs } from '../core/inputs'
@@ -38,6 +43,7 @@ export interface Arguments {
3843 commentTag ?: string
3944 results ?: number
4045 exitOnFail ?: boolean
46+ exitOnEmpty ?: boolean
4147 fetchPreviousResults ?: boolean
4248 reportOrder ?: string
4349 maxWorkflowRunsToCheck ?: number
@@ -321,6 +327,11 @@ async function main(): Promise<void> {
321327 description : 'Fail action when if tests fail' ,
322328 default : false
323329 } )
330+ . options ( 'exit-on-empty' , {
331+ type : 'boolean' ,
332+ description : 'Fail action when if no tests are found' ,
333+ default : false
334+ } )
324335 . options ( 'update-comment' , {
325336 type : 'boolean' ,
326337 description : 'Updates existing Pull Request comment' ,
@@ -379,6 +390,9 @@ async function main(): Promise<void> {
379390
380391 await processPrComment ( argv , report , inputs )
381392
393+ if ( inputs . exitOnEmpty ) {
394+ exitActionOnEmpty ( report )
395+ }
382396 if ( inputs . exitOnFail ) {
383397 exitActionOnFail ( report )
384398 }
0 commit comments