@@ -22,7 +22,7 @@ const writeFile = promisify(fs.writeFile);
22
22
* If specific queries should be run, RUN_ALL cannot be true
23
23
*/
24
24
const 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 ;
26
26
27
27
/**
28
28
* Set to true to avoid using the GitHub API to post a comment
@@ -124,9 +124,8 @@ function isConfig(config: any): config is Config {
124
124
*/
125
125
const queriesChanged = new Set < string > ( ) ;
126
126
let unableToGetChangedQueries = false ;
127
- let queryPattern = ( process . env . QUERY_PATTERN != "" ) ;
128
127
129
- if ( ! RUN_ALL && ! queryPattern ) {
128
+ if ( ! RUN_ALL && ! QUERY_PATTERN ) {
130
129
131
130
/*
132
131
* There are a few different ways in which we may determine which queries
@@ -277,7 +276,7 @@ function isConfig(config: any): config is Config {
277
276
for ( const query of Object . keys ( config . expectedResults ) ) {
278
277
const exists = await access ( query , fs . constants . R_OK ) . then ( ( ) => true , ( ) => false ) ;
279
278
// 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 ) ) ) {
279
+ if ( exists && ( RUN_ALL || unableToGetChangedQueries || queriesChanged . has ( query ) ) || ( QUERY_PATTERN && QUERY_PATTERN . test ( query ) ) ) {
281
280
queriesToRun . push ( query ) ;
282
281
}
283
282
}
0 commit comments