forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
merge-config.js
52 lines (50 loc) · 1.61 KB
/
merge-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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',
},
// 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`.
// In the components repository, since we don't use fixup or squash commits, we can
// use the Github API merge strategy. That way we ensure that PRs show up as `Merged`.
githubApiMerge: {
default: 'squash',
labels: [
{pattern: 'preserve commits', method: 'rebase'}
]
},
claSignedLabel: 'cla: yes',
mergeReadyLabel: 'merge ready',
commitMessageFixupLabel: 'commit message fixup',
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 => Number(segment));
return {major, minor, patch};
}