Skip to content

Commit c063fbc

Browse files
authored
build: use new labeling and branching in merge script (#20295)
We introduced a new shared configuration for merge script labels that follow the new proposal: https://docs.google.com/document/d/197kVillDwx-RZtSVOBtPb4BBIAw0E9RT3q3v6DZkykU These label semantics and the new branching are set up for the Angular Components repository with this commit. The goal is that labeling and merging is consistent between all Angular projects and that clear rules are defined for branching/labeling. This was previously not the case
1 parent c4b7604 commit c063fbc

File tree

3 files changed

+9
-36
lines changed

3 files changed

+9
-36
lines changed

.ng-dev/merge.ts

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
1-
import {MergeConfig} from '@angular/dev-infra-private/pr/merge/config';
2-
import {determineMergeBranches} from '@angular/dev-infra-private/pr/merge/determine-merge-branches';
1+
import {DevInfraMergeConfig} from '@angular/dev-infra-private/pr/merge/config';
2+
import {getDefaultTargetLabelConfiguration} from '@angular/dev-infra-private/pr/merge/defaults';
3+
import {github} from './github';
34

45
/**
56
* Configuration for the merge tool in `ng-dev`. This sets up the labels which
67
* are respected by the merge script (e.g. the target labels).
78
*/
8-
export const merge = (): MergeConfig => {
9-
const currentVersion = require('../package.json').version;
10-
// We use the `@angular/cdk` as source of truth for the latest published version in NPM.
11-
// Any package from the monorepo could technically work and result in the same version.
12-
13-
// TODO(devversion) Clean this up once the label/branching has been finalized.
14-
// let {minor, patch} = determineMergeBranches(currentVersion, '@angular/cdk');
15-
const patch = '10.1.x';
16-
const minor = 'master';
17-
9+
export const merge: DevInfraMergeConfig['merge'] = async api => {
1810
return {
1911
// By default, the merge script merges locally with `git cherry-pick` and autosquash.
2012
// This has the downside of pull requests showing up as `Closed` instead of `Merged`.
@@ -30,26 +22,6 @@ export const merge = (): MergeConfig => {
3022
mergeReadyLabel: 'merge ready',
3123
commitMessageFixupLabel: 'commit message fixup',
3224
caretakerNoteLabel: 'caretaker note',
33-
labels: [
34-
{
35-
pattern: 'target: patch',
36-
branches: ['master', patch],
37-
},
38-
{
39-
pattern: 'target: minor',
40-
// TODO: Clean this up after the labels/branching has been finalized.
41-
branches: minor === 'master' ? ['master'] : ['master', minor],
42-
},
43-
{
44-
pattern: 'target: major',
45-
branches: ['master'],
46-
},
47-
{
48-
pattern: 'target: development-branch',
49-
// Merge PRs with the given label only into the target branch that has
50-
// been specified through the Github UI.
51-
branches: (target) => [target],
52-
}
53-
],
25+
labels: await getDefaultTargetLabelConfiguration(api, github, '@angular/cdk'),
5426
};
5527
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"@angular/bazel": "^10.0.8",
7575
"@angular/benchpress": "^0.2.1",
7676
"@angular/compiler-cli": "^10.0.8",
77-
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#0612a30aaf7a7e7eb2a4a5a9fa0f58622ce59590",
77+
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#d0855af987db4e426477da1780bcd02941c31271",
7878
"@angular/platform-browser-dynamic": "^10.0.8",
7979
"@angular/platform-server": "^10.0.8",
8080
"@angular/router": "^10.0.8",

yarn.lock

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@
135135
dependencies:
136136
tslib "^1.9.0"
137137

138-
"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#0612a30aaf7a7e7eb2a4a5a9fa0f58622ce59590":
138+
"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#d0855af987db4e426477da1780bcd02941c31271":
139139
version "0.0.0"
140-
resolved "https://github.com/angular/dev-infra-private-builds.git#0612a30aaf7a7e7eb2a4a5a9fa0f58622ce59590"
140+
resolved "https://github.com/angular/dev-infra-private-builds.git#d0855af987db4e426477da1780bcd02941c31271"
141141
dependencies:
142142
"@angular/benchpress" "0.2.0"
143143
"@octokit/graphql" "^4.3.1"
@@ -149,6 +149,7 @@
149149
inquirer "^7.1.0"
150150
minimatch "^3.0.4"
151151
multimatch "^4.0.0"
152+
node-fetch "^2.6.0"
152153
node-uuid "1.4.8"
153154
semver "^6.3.0"
154155
shelljs "^0.8.3"

0 commit comments

Comments
 (0)