feat(dev-infra): prevent pr merges of features or breaking changes on rc (#41660)
Prevent pull requests targeting `target: rc` from merging PRs with breaking changes or features from being merged. PR Close #41660
This commit is contained in:
		
							parent
							
								
									62e3f3279d
								
							
						
					
					
						commit
						83d6a96163
					
				| @ -3614,23 +3614,23 @@ function assertChangesAllowForTargetLabel(commits, label, config) { | ||||
|     var exemptedScopes = config.targetLabelExemptScopes || []; | ||||
|     /** List of commits which are subject to content requirements for the target label. */ | ||||
|     commits = commits.filter(function (commit) { return !exemptedScopes.includes(commit.scope); }); | ||||
|     var hasBreakingChanges = commits.some(function (commit) { return commit.breakingChanges.length !== 0; }); | ||||
|     var hasFeatureCommits = commits.some(function (commit) { return commit.type === 'feat'; }); | ||||
|     switch (label.pattern) { | ||||
|         case 'target: major': | ||||
|             break; | ||||
|         case 'target: minor': | ||||
|             // Check if any commits in the pull request contains a breaking change.
 | ||||
|             if (commits.some(function (commit) { return commit.breakingChanges.length !== 0; })) { | ||||
|             if (hasBreakingChanges) { | ||||
|                 throw PullRequestFailure.hasBreakingChanges(label); | ||||
|             } | ||||
|             break; | ||||
|         case 'target: rc': | ||||
|         case 'target: patch': | ||||
|         case 'target: lts': | ||||
|             // Check if any commits in the pull request contains a breaking change.
 | ||||
|             if (commits.some(function (commit) { return commit.breakingChanges.length !== 0; })) { | ||||
|             if (hasBreakingChanges) { | ||||
|                 throw PullRequestFailure.hasBreakingChanges(label); | ||||
|             } | ||||
|             // Check if any commits in the pull request contains a commit type of "feat".
 | ||||
|             if (commits.some(function (commit) { return commit.type === 'feat'; })) { | ||||
|             if (hasFeatureCommits) { | ||||
|                 throw PullRequestFailure.hasFeatureCommits(label); | ||||
|             } | ||||
|             break; | ||||
|  | ||||
| @ -200,23 +200,23 @@ function assertChangesAllowForTargetLabel( | ||||
|   const exemptedScopes = config.targetLabelExemptScopes || []; | ||||
|   /** List of commits which are subject to content requirements for the target label. */ | ||||
|   commits = commits.filter(commit => !exemptedScopes.includes(commit.scope)); | ||||
|   const hasBreakingChanges = commits.some(commit => commit.breakingChanges.length !== 0); | ||||
|   const hasFeatureCommits = commits.some(commit => commit.type === 'feat'); | ||||
|   switch (label.pattern) { | ||||
|     case 'target: major': | ||||
|       break; | ||||
|     case 'target: minor': | ||||
|       // Check if any commits in the pull request contains a breaking change.
 | ||||
|       if (commits.some(commit => commit.breakingChanges.length !== 0)) { | ||||
|       if (hasBreakingChanges) { | ||||
|         throw PullRequestFailure.hasBreakingChanges(label); | ||||
|       } | ||||
|       break; | ||||
|     case 'target: rc': | ||||
|     case 'target: patch': | ||||
|     case 'target: lts': | ||||
|       // Check if any commits in the pull request contains a breaking change.
 | ||||
|       if (commits.some(commit => commit.breakingChanges.length !== 0)) { | ||||
|       if (hasBreakingChanges) { | ||||
|         throw PullRequestFailure.hasBreakingChanges(label); | ||||
|       } | ||||
|       // Check if any commits in the pull request contains a commit type of "feat".
 | ||||
|       if (commits.some(commit => commit.type === 'feat')) { | ||||
|       if (hasFeatureCommits) { | ||||
|         throw PullRequestFailure.hasFeatureCommits(label); | ||||
|       } | ||||
|       break; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user