Commit dd62773 1 parent 74820d8 commit dd62773 Copy full SHA for dd62773
File tree 2 files changed +20
-2
lines changed
packages/aws-cdk-lib/aws-codepipeline
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -166,11 +166,14 @@ export class Trigger {
166
166
}
167
167
168
168
pushFilter ?. forEach ( filter => {
169
+ if ( ! filter . branchesExcludes && ! filter . branchesIncludes && ( filter . filePathsExcludes || filter . filePathsIncludes ) ) {
170
+ throw new Error ( `cannot specify filePaths without branches in pushFilter for sourceAction with name '${ sourceAction . actionProperties . actionName } '` ) ;
171
+ }
169
172
if ( ( filter . tagsExcludes || filter . tagsIncludes ) && ( filter . branchesExcludes || filter . branchesIncludes ) ) {
170
173
throw new Error ( `cannot specify both tags and branches in pushFilter for sourceAction with name '${ sourceAction . actionProperties . actionName } '` ) ;
171
174
}
172
- if ( ! filter . branchesExcludes && ! filter . branchesIncludes && ( filter . filePathsExcludes || filter . filePathsIncludes ) ) {
173
- throw new Error ( `cannot specify filePaths without branches in pushFilter for sourceAction with name '${ sourceAction . actionProperties . actionName } '` ) ;
175
+ if ( ! filter . tagsExcludes && ! filter . tagsIncludes && ! filter . branchesExcludes && ! filter . branchesIncludes ) {
176
+ throw new Error ( `must specify either tags or branches in pushFilter for sourceAction with name '${ sourceAction . actionProperties . actionName } '` ) ;
174
177
}
175
178
if ( filter . tagsExcludes && filter . tagsExcludes . length > 8 ) {
176
179
throw new Error ( `maximum length of tagsExcludes in pushFilter for sourceAction with name '${ sourceAction . actionProperties . actionName } ' is 8, got ${ filter . tagsExcludes . length } ` ) ;
Original file line number Diff line number Diff line change @@ -584,6 +584,21 @@ describe('triggers', () => {
584
584
} ) . toThrow ( / c a n n o t s p e c i f y b o t h t a g s a n d b r a n c h e s i n p u s h F i l t e r f o r s o u r c e A c t i o n w i t h n a m e ' C o d e S t a r C o n n e c t i o n s S o u r c e A c t i o n ' / ) ;
585
585
} ) ;
586
586
587
+ test ( 'throw if neither tags nor branches are specified in pushFilter' , ( ) => {
588
+ expect ( ( ) => {
589
+ new codepipeline . Pipeline ( stack , 'Pipeline' , {
590
+ pipelineType : codepipeline . PipelineType . V2 ,
591
+ triggers : [ {
592
+ providerType : codepipeline . ProviderType . CODE_STAR_SOURCE_CONNECTION ,
593
+ gitConfiguration : {
594
+ sourceAction,
595
+ pushFilter : [ { } ] ,
596
+ } ,
597
+ } ] ,
598
+ } ) ;
599
+ } ) . toThrow ( / m u s t s p e c i f y e i t h e r t a g s o r b r a n c h e s i n p u s h F i l t e r f o r s o u r c e A c t i o n w i t h n a m e ' C o d e S t a r C o n n e c t i o n s S o u r c e A c t i o n ' / ) ;
600
+ } ) ;
601
+
587
602
test ( 'throw if filePaths without branches is specified in pushFilter' , ( ) => {
588
603
expect ( ( ) => {
589
604
new codepipeline . Pipeline ( stack , 'Pipeline' , {
You can’t perform that action at this time.
0 commit comments