From aebecc2ffff011218bed23cc46f03b5f4efbee98 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 13 Aug 2020 14:37:26 +0200 Subject: [PATCH] build: use new labeling and branching in merge script 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 --- .ng-dev/merge.ts | 38 +++++--------------------------------- package.json | 2 +- yarn.lock | 5 +++-- 3 files changed, 9 insertions(+), 36 deletions(-) diff --git a/.ng-dev/merge.ts b/.ng-dev/merge.ts index d6d7a1d8c8da..9986012dc9c4 100644 --- a/.ng-dev/merge.ts +++ b/.ng-dev/merge.ts @@ -1,20 +1,12 @@ -import {MergeConfig} from '@angular/dev-infra-private/pr/merge/config'; -import {determineMergeBranches} from '@angular/dev-infra-private/pr/merge/determine-merge-branches'; +import {DevInfraMergeConfig} from '@angular/dev-infra-private/pr/merge/config'; +import {getDefaultTargetLabelConfiguration} from '@angular/dev-infra-private/pr/merge/defaults'; +import {github} from './github'; /** * Configuration for the merge tool in `ng-dev`. This sets up the labels which * are respected by the merge script (e.g. the target labels). */ -export const merge = (): MergeConfig => { - const currentVersion = require('../package.json').version; - // We use the `@angular/cdk` as source of truth for the latest published version in NPM. - // Any package from the monorepo could technically work and result in the same version. - - // TODO(devversion) Clean this up once the label/branching has been finalized. - // let {minor, patch} = determineMergeBranches(currentVersion, '@angular/cdk'); - const patch = '10.1.x'; - const minor = 'master'; - +export const merge: DevInfraMergeConfig['merge'] = async api => { return { // By default, the merge script merges locally with `git cherry-pick` and autosquash. // This has the downside of pull requests showing up as `Closed` instead of `Merged`. @@ -30,26 +22,6 @@ export const merge = (): MergeConfig => { mergeReadyLabel: 'merge ready', commitMessageFixupLabel: 'commit message fixup', caretakerNoteLabel: 'caretaker note', - labels: [ - { - pattern: 'target: patch', - branches: ['master', patch], - }, - { - pattern: 'target: minor', - // TODO: Clean this up after the labels/branching has been finalized. - branches: minor === 'master' ? ['master'] : ['master', minor], - }, - { - pattern: 'target: major', - branches: ['master'], - }, - { - pattern: 'target: development-branch', - // Merge PRs with the given label only into the target branch that has - // been specified through the Github UI. - branches: (target) => [target], - } - ], + labels: await getDefaultTargetLabelConfiguration(api, github, '@angular/cdk'), }; }; diff --git a/package.json b/package.json index 5f6ee734c9a7..aaefb644a8b3 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "@angular/bazel": "^10.0.8", "@angular/benchpress": "^0.2.1", "@angular/compiler-cli": "^10.0.8", - "@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#0612a30aaf7a7e7eb2a4a5a9fa0f58622ce59590", + "@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#d0855af987db4e426477da1780bcd02941c31271", "@angular/platform-browser-dynamic": "^10.0.8", "@angular/platform-server": "^10.0.8", "@angular/router": "^10.0.8", diff --git a/yarn.lock b/yarn.lock index 09453e02511d..030964f693b2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -135,9 +135,9 @@ dependencies: tslib "^1.9.0" -"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#0612a30aaf7a7e7eb2a4a5a9fa0f58622ce59590": +"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#d0855af987db4e426477da1780bcd02941c31271": version "0.0.0" - resolved "https://github.com/angular/dev-infra-private-builds.git#0612a30aaf7a7e7eb2a4a5a9fa0f58622ce59590" + resolved "https://github.com/angular/dev-infra-private-builds.git#d0855af987db4e426477da1780bcd02941c31271" dependencies: "@angular/benchpress" "0.2.0" "@octokit/graphql" "^4.3.1" @@ -149,6 +149,7 @@ inquirer "^7.1.0" minimatch "^3.0.4" multimatch "^4.0.0" + node-fetch "^2.6.0" node-uuid "1.4.8" semver "^6.3.0" shelljs "^0.8.3"