Skip to content

Commit

Permalink
build: create merge script config for components repo
Browse files Browse the repository at this point in the history
Adds a merge script config for the components repo.
Additionally, wires up a shorthand Yarn script for merging PRs
  • Loading branch information
devversion committed Mar 19, 2020
1 parent b16ece5 commit d405bd6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
41 changes: 41 additions & 0 deletions merge-config.js
Original file line number Diff line number Diff line change
@@ -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};
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit d405bd6

Please sign in to comment.