diff --git a/ng-dev/pr/common/targeting/labels.ts b/ng-dev/pr/common/targeting/labels.ts index 5a629af52..aa27b39f5 100644 --- a/ng-dev/pr/common/targeting/labels.ts +++ b/ng-dev/pr/common/targeting/labels.ts @@ -29,6 +29,7 @@ import { import {assertActiveLtsBranch} from './lts-branch.js'; import {GithubClient} from '../../../utils/git/github.js'; import {Log} from '../../../utils/logging.js'; +import {assertValidPullRequestConfig, PullRequestConfig} from '../../config/index.js'; /** * Gets a list of target labels which should be considered by the merge @@ -45,9 +46,14 @@ import {Log} from '../../../utils/logging.js'; export async function getTargetLabelsForActiveReleaseTrains( {latest, releaseCandidate, next}: ActiveReleaseTrains, api: GithubClient, - config: NgDevConfig<{github?: GithubConfig; release?: ReleaseConfig}>, + config: NgDevConfig<{ + github: GithubConfig; + pullRequest: PullRequestConfig; + release?: ReleaseConfig; + }>, ): Promise { assertValidGithubConfig(config); + assertValidPullRequestConfig(config); const nextBranchName = getNextBranchName(config.github); const repo: ReleaseRepoWithApi = { @@ -80,7 +86,14 @@ export async function getTargetLabelsForActiveReleaseTrains( // TODO: Consider handling this automatically by checking if the NPM version matches // the last-minor. If not, then an exceptional minor might be in progress. See: // https://docs.google.com/document/d/197kVillDwx-RZtSVOBtPb4BBIAw0E9RT3q3v6DZkykU/edit#heading=h.h7o5pjq6yqd0 - branches: () => [nextBranchName], + branches: () => { + // TODO(devversion): Remove this when we actually support exceptional minors. + if (config.pullRequest.__specialTreatRcAsExceptionalMinor && releaseCandidate !== null) { + return [releaseCandidate.branchName]; + } + + return [nextBranchName]; + }, }, { name: TargetLabelName.PATCH, diff --git a/ng-dev/pr/config/index.ts b/ng-dev/pr/config/index.ts index 33a27a94f..414854fcf 100644 --- a/ng-dev/pr/config/index.ts +++ b/ng-dev/pr/config/index.ts @@ -51,6 +51,14 @@ export interface PullRequestConfig { * scopes in patch branches, no breaking changes in minor or patch changes. */ targetLabelExemptScopes?: string[]; + + /** + * Special flag that should **NOT** be used without confirming with the dev-infra team. + * This flag turns the RC/FF release-train into an exceptional minor release-train by: + * + * - changing `target: minor` to point to `target: rc` (without the RC merge restrictions) + */ + __specialTreatRcAsExceptionalMinor?: boolean; } /** Loads and validates the merge configuration. */ diff --git a/ng-dev/pr/merge/integration.spec.ts b/ng-dev/pr/merge/integration.spec.ts index 9aacf42e0..a1c37a1b6 100644 --- a/ng-dev/pr/merge/integration.spec.ts +++ b/ng-dev/pr/merge/integration.spec.ts @@ -115,6 +115,11 @@ describe('default target labels', () => { const targetLabels = await getTargetLabelsForActiveReleaseTrains(releaseTrains, api, { github: githubConfig, release: releaseConfig, + pullRequest: { + commitMessageFixupLabel: 'commit message fixup', + githubApiMerge: false, + mergeReadyLabel: 'merge ready', + }, __isNgDevConfigObject: true, }); let label: TargetLabel;