豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 3276c53

Browse files
committed
feat(ng-dev): support exceptional minor target labeling in the interim
Until we have implemented the actual exceptional minor mechanism in both the release and merge tool, we want to be able to turn `target: minor` into `target: rc` (internally) so that minor changes can go into the RC/FF phase that we "misuse" as the exceptional minor release train.
1 parent 5a1ba84 commit 3276c53

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

ng-dev/pr/common/targeting/labels.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
import {assertActiveLtsBranch} from './lts-branch.js';
3030
import {GithubClient} from '../../../utils/git/github.js';
3131
import {Log} from '../../../utils/logging.js';
32+
import {assertValidPullRequestConfig, PullRequestConfig} from '../../config/index.js';
3233

3334
/**
3435
* Gets a list of target labels which should be considered by the merge
@@ -45,9 +46,14 @@ import {Log} from '../../../utils/logging.js';
4546
export async function getTargetLabelsForActiveReleaseTrains(
4647
{latest, releaseCandidate, next}: ActiveReleaseTrains,
4748
api: GithubClient,
48-
config: NgDevConfig<{github?: GithubConfig; release?: ReleaseConfig}>,
49+
config: NgDevConfig<{
50+
github: GithubConfig;
51+
pullRequest: PullRequestConfig;
52+
release?: ReleaseConfig;
53+
}>,
4954
): Promise<TargetLabel[]> {
5055
assertValidGithubConfig(config);
56+
assertValidPullRequestConfig(config);
5157

5258
const nextBranchName = getNextBranchName(config.github);
5359
const repo: ReleaseRepoWithApi = {
@@ -80,7 +86,14 @@ export async function getTargetLabelsForActiveReleaseTrains(
8086
// TODO: Consider handling this automatically by checking if the NPM version matches
8187
// the last-minor. If not, then an exceptional minor might be in progress. See:
8288
// https://docs.google.com/document/d/197kVillDwx-RZtSVOBtPb4BBIAw0E9RT3q3v6DZkykU/edit#heading=h.h7o5pjq6yqd0
83-
branches: () => [nextBranchName],
89+
branches: () => {
90+
// TODO(devversion): Remove this when we actually support exceptional minors.
91+
if (config.pullRequest.__specialTreatRcAsExceptionalMinor && releaseCandidate !== null) {
92+
return [releaseCandidate.branchName];
93+
}
94+
95+
return [nextBranchName];
96+
},
8497
},
8598
{
8699
name: TargetLabelName.PATCH,

ng-dev/pr/config/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ export interface PullRequestConfig {
5151
* scopes in patch branches, no breaking changes in minor or patch changes.
5252
*/
5353
targetLabelExemptScopes?: string[];
54+
55+
/**
56+
* Special flag that should **NOT** be used without confirming with the dev-infra team.
57+
* This flag turns the RC/FF release-train into an exceptional minor release-train by:
58+
*
59+
* - changing `target: minor` to point to `target: rc` (without the RC merge restrictions)
60+
*/
61+
__specialTreatRcAsExceptionalMinor?: boolean;
5462
}
5563

5664
/** Loads and validates the merge configuration. */

ng-dev/pr/merge/integration.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ describe('default target labels', () => {
115115
const targetLabels = await getTargetLabelsForActiveReleaseTrains(releaseTrains, api, {
116116
github: githubConfig,
117117
release: releaseConfig,
118+
pullRequest: {
119+
commitMessageFixupLabel: 'commit message fixup',
120+
githubApiMerge: false,
121+
mergeReadyLabel: 'merge ready',
122+
},
118123
__isNgDevConfigObject: true,
119124
});
120125
let label: TargetLabel;

0 commit comments

Comments
 (0)