File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,9 @@ const conditionEvaluationContext: object = (() => {
3333 // We cannot process references to `author` in conditions.
3434 Object . defineProperty ( context , 'author' , {
3535 get : ( ) => {
36- throw new PullApproveAuthorStateDependencyError ( ) ;
36+ const x : any = new String ( ) ;
37+ x . matchesAny = true ;
38+ return x ;
3739 } ,
3840 } ) ;
3941
@@ -79,6 +81,8 @@ export function convertConditionToFunction(
7981 */
8082function transformExpressionToJs ( expression : string ) : string {
8183 return expression
84+ . replace ( / ^ ( .+ ) \s + n o t i n \s + ( \[ .+ \] ) $ / , '!$2.some(x => $1.matchesAny || $1 == x)' )
85+ . replace ( / ^ ( .+ ) \s + i n \s + ( .+ ) $ / , '$2.some(x => $1.matchesAny || $1 == x)' )
8286 . replace ( / ^ ( .+ ) \s + n o t i n \s + ( .+ ) $ / , '!$2.includes($1)' )
8387 . replace ( / ^ ( .+ ) \s + i n \s + ( .+ ) $ / , '$2.includes($1)' )
8488 . replace ( / n o t \s + / g, '!' ) ;
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ describe('group parsing', () => {
7979 expect ( ( ) => fwCore . testFile ( 'any' ) ) . not . toThrow ( ) ;
8080 } ) ;
8181
82- it ( 'should never match groups with conditions that rely on author state ', ( ) => {
82+ describe ( 'automaticall matches for author and ', ( ) => {
8383 const groups = getGroupsFromYaml ( `
8484 groups:
8585 renovate-notify-group:
@@ -89,8 +89,13 @@ describe('group parsing', () => {
8989 ` ) ;
9090 const renovateGroup = getGroupByName ( groups , 'renovate-notify-group' ) ! ;
9191
92- expect ( renovateGroup . testFile ( 'packages/core/index.ts' ) ) . toBe ( false ) ;
93- expect ( renovateGroup . conditions [ 0 ] . unverifiable ) . toBe ( true ) ;
92+ it ( 'can pass with a file match' , ( ) => {
93+ expect ( renovateGroup . testFile ( 'packages/core/index.ts' ) ) . toBe ( true ) ;
94+ } ) ;
95+
96+ it ( 'can fail without a file match' , ( ) => {
97+ expect ( renovateGroup . testFile ( 'packages/not-core/index.ts' ) ) . toBe ( false ) ;
98+ } ) ;
9499 } ) ;
95100
96101 describe ( 'in operator' , ( ) => {
You can’t perform that action at this time.
0 commit comments