@@ -22,7 +22,7 @@ const writeFile = promisify(fs.writeFile);
2222 * If specific queries should be run, RUN_ALL cannot be true
2323 */
2424const RUN_ALL = process . env . RUN_ALL === 'true' ;
25- const QUERY_PATTERN : RegExp = RegExp ( String ( process . env . QUERY_PATTERN ) ) ;
25+ const QUERY_PATTERN : RegExp | null = process . env . QUERY_PATTERN !== '' ? RegExp ( process . env . QUERY_PATTERN ) : null ;
2626
2727/**
2828 * Set to true to avoid using the GitHub API to post a comment
@@ -124,9 +124,8 @@ function isConfig(config: any): config is Config {
124124 */
125125 const queriesChanged = new Set < string > ( ) ;
126126 let unableToGetChangedQueries = false ;
127- let queryPattern = ( process . env . QUERY_PATTERN != "" ) ;
128127
129- if ( ! RUN_ALL && ! queryPattern ) {
128+ if ( ! RUN_ALL && ! QUERY_PATTERN ) {
130129
131130 /*
132131 * There are a few different ways in which we may determine which queries
@@ -277,8 +276,7 @@ function isConfig(config: any): config is Config {
277276 for ( const query of Object . keys ( config . expectedResults ) ) {
278277 const exists = await access ( query , fs . constants . R_OK ) . then ( ( ) => true , ( ) => false ) ;
279278 // Run the query if either it's changed, or runAll is true
280- if ( exists && ( RUN_ALL || unableToGetChangedQueries || queriesChanged . has ( query ) ) || ( queryPattern && QUERY_PATTERN . test ( query ) ) ) {
281- console . log ( 'query: ' + query + ' / RUN_ALL: ' + RUN_ALL + ' / unableToGetChangedQueries: ' + unableToGetChangedQueries + ' / regex test: ' + QUERY_PATTERN . test ( query ) )
279+ if ( exists && ( RUN_ALL || unableToGetChangedQueries || queriesChanged . has ( query ) ) || ( QUERY_PATTERN && QUERY_PATTERN . test ( query ) ) ) {
282280 queriesToRun . push ( query ) ;
283281 }
284282 }
0 commit comments