From d405bd641ddbdc7ac71faf257f72670c6aa3e530 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 18 Mar 2020 16:41:00 +0100 Subject: [PATCH] build: create merge script config for components repo Adds a merge script config for the components repo. Additionally, wires up a shorthand Yarn script for merging PRs --- merge-config.js | 41 +++++++++++++++++++++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 merge-config.js diff --git a/merge-config.js b/merge-config.js new file mode 100644 index 000000000000..90ec69dc9ef8 --- /dev/null +++ b/merge-config.js @@ -0,0 +1,41 @@ +module.exports = () => { + const {major, minor} = parseVersion(require('./package').version); + const patchBranch = `${major}.${minor}.x`; + const minorBranch = `${major}.x`; + + return { + projectRoot: __dirname, + repository: { + user: 'angular', + name: 'components', + }, + claSignedLabel: 'cla: yes', + mergeReadyLabel: 'merge ready', + labels: [ + { + pattern: 'target: patch', + branches: ['master', patchBranch], + }, + { + pattern: 'target: minor', + branches: ['master', minorBranch], + }, + { + 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], + } + ], + } +}; + +/** Converts a version string into an object. */ +function parseVersion(version) { + const [major = 0, minor = 0, patch = 0] = version.split('.').map(segment => parseInt(segment)); + return {major, minor, patch}; +} diff --git a/package.json b/package.json index 154eb33bd7ce..3d3d6d073507 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,8 @@ "ownerslint": "ts-node --project scripts/ scripts/ownerslint.ts", "tslint": "tslint -c tslint.json --project ./tsconfig.json", "stylelint": "stylelint \"src/**/*.+(css|scss)\" --config .stylelintrc.json --syntax scss", - "resync-caretaker-app": "ts-node --project scripts scripts/caretaking/resync-caretaker-app-prs.ts" + "resync-caretaker-app": "ts-node --project scripts scripts/caretaking/resync-caretaker-app-prs.ts", + "merge": "ts-node --project scripts scripts/merge-script/cli.ts --config ./merge-config.js" }, "version": "9.1.3", "dependencies": {