backport 8.4.4 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entrypoint.module.d.ts +1 -1
- package/dist/entrypoint.module.js +8 -7
- package/dist/entrypoint.module.private.test.js +79 -29
- package/dist/lib/cherrypickAndCreateTargetPullRequest.js +1 -1
- package/dist/lib/cherrypickAndCreateTargetPullRequest.test.js +12 -4
- package/dist/lib/getCommits.js +14 -9
- package/dist/lib/getCommitsWithoutBackports.js +3 -3
- package/dist/lib/getCommitsWithoutBackports.test.js +38 -15
- package/dist/lib/getTargetBranches.d.ts +1 -1
- package/dist/lib/getTargetBranches.js +6 -10
- package/dist/lib/getTargetBranches.test.js +9 -5
- package/dist/lib/git.d.ts +2 -2
- package/dist/lib/git.test.js +3 -1
- package/dist/lib/github/v3/createPullRequest.test.js +39 -13
- package/dist/lib/github/v3/createStatusComment.js +5 -2
- package/dist/lib/github/v3/createStatusComment.test.js +7 -3
- package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.js +20 -1
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +32 -10
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.private.test.js +9 -1
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +49 -14
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +15 -5
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +41 -11
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +1 -1
- package/dist/lib/prompt.test.js +37 -9
- package/dist/lib/prompts.js +5 -2
- package/dist/lib/setupRepo.js +3 -3
- package/dist/lib/sourceCommit/getPullRequestStates.d.ts +27 -0
- package/dist/lib/sourceCommit/{getExpectedTargetPullRequests.js → getPullRequestStates.js} +62 -27
- package/dist/lib/sourceCommit/{getExpectedTargetPullRequests.test.d.ts → getPullRequestStates.test.d.ts} +0 -0
- package/dist/lib/sourceCommit/{getExpectedTargetPullRequests.test.js → getPullRequestStates.test.js} +283 -87
- package/dist/lib/sourceCommit/parseSourceCommit.d.ts +4 -2
- package/dist/lib/sourceCommit/parseSourceCommit.js +20 -5
- package/dist/lib/sourceCommit/parseSourceCommit.test.js +78 -25
- package/dist/options/ConfigOptions.d.ts +1 -1
- package/dist/options/config/config.d.ts +1 -1
- package/dist/options/config/readConfigFile.d.ts +1 -1
- package/dist/options/options.d.ts +1 -1
- package/dist/test/e2e/cli/entrypoint.cli.private.test.js +2 -2
- package/dist/test/e2e/cli/repo-with-changing-branchLabelMapping.private.test.d.ts +1 -0
- package/dist/test/e2e/cli/repo-with-changing-branchLabelMapping.private.test.js +95 -0
- package/dist/test/e2e/module/entrypoint.module.mutation.test.js +11 -4
- package/dist/test/handleUnbackportedPullRequests.private.test.js +10 -1
- package/dist/utils/filterUnmergedCommits.js +1 -1
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +13 -13
- package/yarn.lock +512 -425
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.d.ts +0 -16
|
@@ -42,8 +42,12 @@ describe('parseSourceCommit', () => {
|
|
|
42
42
|
expect(commit.sourceBranch).toBe('sourcebranch-from-options');
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
|
-
describe('
|
|
46
|
-
it('uses options.branchLabelMapping when
|
|
45
|
+
describe('pullRequestStates', () => {
|
|
46
|
+
it('uses options.branchLabelMapping when sourceCommit is empty', () => {
|
|
47
|
+
const branchLabelMapping = {
|
|
48
|
+
'^v6.4.0$': 'main',
|
|
49
|
+
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
50
|
+
};
|
|
47
51
|
const mockSourceCommit = (0, getMockSourceCommit_1.getMockSourceCommit)({
|
|
48
52
|
sourceCommit: {
|
|
49
53
|
message: 'My commit message (#66)',
|
|
@@ -72,15 +76,27 @@ describe('parseSourceCommit', () => {
|
|
|
72
76
|
const commit = (0, parseSourceCommit_1.parseSourceCommit)({
|
|
73
77
|
sourceCommit: mockSourceCommit,
|
|
74
78
|
options: {
|
|
75
|
-
branchLabelMapping
|
|
76
|
-
'^v6.4.0$': 'main',
|
|
77
|
-
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
78
|
-
},
|
|
79
|
+
branchLabelMapping,
|
|
79
80
|
},
|
|
80
81
|
});
|
|
81
|
-
expect(commit.
|
|
82
|
+
expect(commit.suggestedTargetBranches).toEqual(['6.1']);
|
|
83
|
+
expect(commit.pullRequestStates).toEqual([
|
|
84
|
+
{
|
|
85
|
+
branch: 'main',
|
|
86
|
+
label: 'v6.4.0',
|
|
87
|
+
isSourceBranch: true,
|
|
88
|
+
mergeCommit: {
|
|
89
|
+
message: 'My commit message (#66)',
|
|
90
|
+
sha: 'DO NOT USE: default-source-commit-sha',
|
|
91
|
+
},
|
|
92
|
+
number: 55,
|
|
93
|
+
state: 'MERGED',
|
|
94
|
+
url: 'https://github.com/elastic/kibana/pull/55',
|
|
95
|
+
},
|
|
82
96
|
{
|
|
83
97
|
branch: '6.3',
|
|
98
|
+
label: 'v6.3.0',
|
|
99
|
+
isSourceBranch: false,
|
|
84
100
|
number: 5678,
|
|
85
101
|
state: 'MERGED',
|
|
86
102
|
url: 'https://github.com/elastic/kibana/pull/5678',
|
|
@@ -91,24 +107,33 @@ describe('parseSourceCommit', () => {
|
|
|
91
107
|
},
|
|
92
108
|
{
|
|
93
109
|
branch: '6.2',
|
|
110
|
+
label: 'v6.2.0',
|
|
111
|
+
isSourceBranch: false,
|
|
94
112
|
number: 9876,
|
|
95
113
|
state: 'OPEN',
|
|
96
114
|
url: 'https://github.com/elastic/kibana/pull/9876',
|
|
97
115
|
},
|
|
98
116
|
{
|
|
99
117
|
branch: '6.1',
|
|
118
|
+
label: 'v6.1.0',
|
|
119
|
+
isSourceBranch: false,
|
|
100
120
|
state: 'NOT_CREATED',
|
|
101
121
|
},
|
|
102
122
|
]);
|
|
103
123
|
});
|
|
104
|
-
it('uses the
|
|
124
|
+
it('uses the sourceCommit branchLabelMapping where 6.3 is pointing to main', () => {
|
|
125
|
+
const sourceCommitBranchLabelMapping = {
|
|
126
|
+
'^v6.3.0$': 'main',
|
|
127
|
+
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
128
|
+
};
|
|
129
|
+
const latestBranchLabelMapping = {
|
|
130
|
+
'^v6.4.0$': 'main',
|
|
131
|
+
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
132
|
+
};
|
|
105
133
|
const mockSourceCommit = (0, getMockSourceCommit_1.getMockSourceCommit)({
|
|
106
134
|
sourceCommit: {
|
|
107
135
|
remoteConfig: {
|
|
108
|
-
branchLabelMapping:
|
|
109
|
-
'^v6.3.0$': 'main',
|
|
110
|
-
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
111
|
-
},
|
|
136
|
+
branchLabelMapping: sourceCommitBranchLabelMapping,
|
|
112
137
|
committedDate: '2021-02-02T00:00:00Z',
|
|
113
138
|
},
|
|
114
139
|
message: 'My commit message (#66)',
|
|
@@ -131,29 +156,54 @@ describe('parseSourceCommit', () => {
|
|
|
131
156
|
const commit = (0, parseSourceCommit_1.parseSourceCommit)({
|
|
132
157
|
sourceCommit: mockSourceCommit,
|
|
133
158
|
options: {
|
|
134
|
-
branchLabelMapping:
|
|
135
|
-
'^v6.4.0$': 'main',
|
|
136
|
-
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
137
|
-
},
|
|
159
|
+
branchLabelMapping: latestBranchLabelMapping,
|
|
138
160
|
},
|
|
139
161
|
});
|
|
140
|
-
expect(commit.
|
|
162
|
+
expect(commit.suggestedTargetBranches).toEqual(['6.1']);
|
|
163
|
+
expect(commit.pullRequestStates).toEqual([
|
|
164
|
+
{
|
|
165
|
+
branch: 'main',
|
|
166
|
+
isSourceBranch: true,
|
|
167
|
+
label: 'v6.3.0',
|
|
168
|
+
mergeCommit: {
|
|
169
|
+
message: 'My commit message (#66)',
|
|
170
|
+
sha: 'DO NOT USE: default-source-commit-sha',
|
|
171
|
+
},
|
|
172
|
+
number: 55,
|
|
173
|
+
state: 'MERGED',
|
|
174
|
+
url: 'https://github.com/elastic/kibana/pull/55',
|
|
175
|
+
},
|
|
141
176
|
{
|
|
142
177
|
branch: '6.2',
|
|
178
|
+
label: 'v6.2.0',
|
|
179
|
+
isSourceBranch: false,
|
|
143
180
|
number: 9876,
|
|
144
181
|
state: 'OPEN',
|
|
145
182
|
url: 'https://github.com/elastic/kibana/pull/9876',
|
|
146
183
|
},
|
|
147
184
|
{
|
|
148
185
|
branch: '6.1',
|
|
186
|
+
label: 'v6.1.0',
|
|
187
|
+
isSourceBranch: false,
|
|
149
188
|
state: 'NOT_CREATED',
|
|
150
189
|
},
|
|
151
190
|
]);
|
|
152
191
|
});
|
|
153
192
|
});
|
|
154
193
|
it('returns the correct source commit', () => {
|
|
194
|
+
const branchLabelMapping = {
|
|
195
|
+
'^v6.3.0$': '6.x',
|
|
196
|
+
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
197
|
+
};
|
|
155
198
|
const mockSourceCommit = (0, getMockSourceCommit_1.getMockSourceCommit)({
|
|
156
|
-
sourceCommit: {
|
|
199
|
+
sourceCommit: {
|
|
200
|
+
remoteConfig: {
|
|
201
|
+
branchLabelMapping,
|
|
202
|
+
committedDate: '2021',
|
|
203
|
+
},
|
|
204
|
+
message: 'My commit message (#1234)',
|
|
205
|
+
sha: 'my-sha',
|
|
206
|
+
},
|
|
157
207
|
sourcePullRequest: {
|
|
158
208
|
number: 1234,
|
|
159
209
|
labels: ['v6.3.0', 'v6.2.0', 'v6.1.0'],
|
|
@@ -175,19 +225,16 @@ describe('parseSourceCommit', () => {
|
|
|
175
225
|
});
|
|
176
226
|
const commit = (0, parseSourceCommit_1.parseSourceCommit)({
|
|
177
227
|
sourceCommit: mockSourceCommit,
|
|
178
|
-
options: {
|
|
179
|
-
branchLabelMapping: {
|
|
180
|
-
'^v6.3.0$': '6.x',
|
|
181
|
-
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
182
|
-
},
|
|
183
|
-
},
|
|
228
|
+
options: { branchLabelMapping },
|
|
184
229
|
});
|
|
185
230
|
const expectedCommit = {
|
|
231
|
+
suggestedTargetBranches: ['6.1'],
|
|
186
232
|
author: { email: 'soren.louv@elastic.co', name: 'Søren Louv-Jansen' },
|
|
187
233
|
sourceCommit: {
|
|
188
234
|
committedDate: '2021-12-22T00:00:00Z',
|
|
189
235
|
message: 'My commit message (#1234)',
|
|
190
236
|
sha: 'my-sha',
|
|
237
|
+
branchLabelMapping,
|
|
191
238
|
},
|
|
192
239
|
sourcePullRequest: {
|
|
193
240
|
number: 1234,
|
|
@@ -198,9 +245,11 @@ describe('parseSourceCommit', () => {
|
|
|
198
245
|
},
|
|
199
246
|
},
|
|
200
247
|
sourceBranch: 'source-branch-from-associated-pull-request',
|
|
201
|
-
|
|
248
|
+
pullRequestStates: [
|
|
202
249
|
{
|
|
203
250
|
branch: '6.x',
|
|
251
|
+
label: 'v6.3.0',
|
|
252
|
+
isSourceBranch: false,
|
|
204
253
|
number: 5678,
|
|
205
254
|
state: 'MERGED',
|
|
206
255
|
url: 'https://github.com/elastic/kibana/pull/5678',
|
|
@@ -211,12 +260,16 @@ describe('parseSourceCommit', () => {
|
|
|
211
260
|
},
|
|
212
261
|
{
|
|
213
262
|
branch: '6.2',
|
|
263
|
+
label: 'v6.2.0',
|
|
264
|
+
isSourceBranch: false,
|
|
214
265
|
number: 9876,
|
|
215
266
|
state: 'OPEN',
|
|
216
267
|
url: 'https://github.com/elastic/kibana/pull/9876',
|
|
217
268
|
},
|
|
218
269
|
{
|
|
219
270
|
branch: '6.1',
|
|
271
|
+
label: 'v6.1.0',
|
|
272
|
+
isSourceBranch: false,
|
|
220
273
|
state: 'NOT_CREATED',
|
|
221
274
|
},
|
|
222
275
|
],
|
|
@@ -46,7 +46,7 @@ declare type Options = Partial<{
|
|
|
46
46
|
publishStatusCommentOnAbort: boolean;
|
|
47
47
|
publishStatusCommentOnFailure: boolean;
|
|
48
48
|
publishStatusCommentOnSuccess: boolean;
|
|
49
|
-
pullNumber: number;
|
|
49
|
+
pullNumber: number | number[];
|
|
50
50
|
repoForkOwner: string;
|
|
51
51
|
repoName: string;
|
|
52
52
|
repoOwner: string;
|
|
@@ -45,7 +45,7 @@ export declare function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsF
|
|
|
45
45
|
publishStatusCommentOnAbort?: boolean | undefined;
|
|
46
46
|
publishStatusCommentOnFailure?: boolean | undefined;
|
|
47
47
|
publishStatusCommentOnSuccess?: boolean | undefined;
|
|
48
|
-
pullNumber?: number | undefined;
|
|
48
|
+
pullNumber?: number | number[] | undefined;
|
|
49
49
|
repoForkOwner?: string | undefined;
|
|
50
50
|
repoName?: string | undefined;
|
|
51
51
|
repoOwner?: string | undefined;
|
|
@@ -34,7 +34,7 @@ export declare function withConfigMigrations({ upstream, labels, branches, ...co
|
|
|
34
34
|
prDescription?: string | undefined;
|
|
35
35
|
prTitle?: string | undefined;
|
|
36
36
|
prFilter?: string | undefined;
|
|
37
|
-
pullNumber?: number | undefined;
|
|
37
|
+
pullNumber?: number | number[] | undefined;
|
|
38
38
|
sha?: string | string[] | undefined;
|
|
39
39
|
resetAuthor?: boolean | undefined;
|
|
40
40
|
repoOwner?: string | undefined;
|
|
@@ -74,7 +74,7 @@ export declare function getOptions({ optionsFromCliArgs, optionsFromModule, }: {
|
|
|
74
74
|
prDescription?: string | undefined;
|
|
75
75
|
prTitle?: string | undefined;
|
|
76
76
|
prFilter?: string | undefined;
|
|
77
|
-
pullNumber?: number | undefined;
|
|
77
|
+
pullNumber?: number | number[] | undefined;
|
|
78
78
|
sha?: string | string[] | undefined;
|
|
79
79
|
resetAuthor: boolean;
|
|
80
80
|
sourceBranch: string;
|
|
@@ -133,7 +133,7 @@ describe('entrypoint cli', () => {
|
|
|
133
133
|
"? Select commit (Use arrow keys)
|
|
134
134
|
❯ 1. Add sheep emoji (#9) 7.8
|
|
135
135
|
2. Change Ulysses to Gretha (conflict) (#8) 7.x
|
|
136
|
-
3. Add 🍏 emoji (#5) 7.
|
|
136
|
+
3. Add 🍏 emoji (#5) 7.8, 7.x
|
|
137
137
|
4. Add family emoji (#2) 7.x
|
|
138
138
|
5. Add \`backport\` dep
|
|
139
139
|
6. Merge pull request #1 from backport-org/add-heart-emoji
|
|
@@ -155,7 +155,7 @@ describe('entrypoint cli', () => {
|
|
|
155
155
|
"? Select commit (Use arrow keys)
|
|
156
156
|
❯ 1. Add sheep emoji (#9) 7.8
|
|
157
157
|
2. Change Ulysses to Gretha (conflict) (#8) 7.x
|
|
158
|
-
3. Add 🍏 emoji (#5) 7.
|
|
158
|
+
3. Add 🍏 emoji (#5) 7.8, 7.x
|
|
159
159
|
4. Add family emoji (#2) 7.x
|
|
160
160
|
5. Add \`backport\` dep
|
|
161
161
|
6. Merge pull request #1 from backport-org/add-heart-emoji"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const getDevAccessToken_1 = require("../../private/getDevAccessToken");
|
|
4
|
+
const runBackportViaCli_1 = require("./runBackportViaCli");
|
|
5
|
+
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
6
|
+
jest.setTimeout(15000);
|
|
7
|
+
describe('backport-org/repo-with-changing-branchLabelMapping', () => {
|
|
8
|
+
describe('for commit merged before branchLabelMapping was changed', () => {
|
|
9
|
+
describe('CLI', () => {
|
|
10
|
+
let commit;
|
|
11
|
+
beforeAll(async () => {
|
|
12
|
+
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
13
|
+
'--repo=backport-org/repo-with-changing-branchLabelMapping',
|
|
14
|
+
'--no-fork',
|
|
15
|
+
`--accessToken=${accessToken}`,
|
|
16
|
+
'--json',
|
|
17
|
+
'--ls',
|
|
18
|
+
]);
|
|
19
|
+
commit = JSON.parse(output).commits[2];
|
|
20
|
+
});
|
|
21
|
+
it('suggests 3 target branches', async () => {
|
|
22
|
+
expect(commit.suggestedTargetBranches).toEqual([
|
|
23
|
+
'8.3',
|
|
24
|
+
'8.2',
|
|
25
|
+
'production',
|
|
26
|
+
]);
|
|
27
|
+
});
|
|
28
|
+
it('should shows 2 target branches as NOT_CREATED', () => {
|
|
29
|
+
expect(commit.pullRequestStates.map(({ branch, label, state }) => ({
|
|
30
|
+
branch,
|
|
31
|
+
label,
|
|
32
|
+
state,
|
|
33
|
+
}))).toEqual([
|
|
34
|
+
{ branch: '8.3', label: 'v8.3.0', state: 'NOT_CREATED' },
|
|
35
|
+
{ branch: '8.2', label: 'v8.2.0', state: 'NOT_CREATED' },
|
|
36
|
+
]);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
describe('JSON', () => {
|
|
40
|
+
it('displays commit correctly', async () => {
|
|
41
|
+
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
42
|
+
'--repo=backport-org/repo-with-changing-branchLabelMapping',
|
|
43
|
+
'--no-fork',
|
|
44
|
+
`--accessToken=${accessToken}`,
|
|
45
|
+
], { waitForString: 'Select commit' });
|
|
46
|
+
expect(output).toContain('Create denmark.txt 8.3, 8.2');
|
|
47
|
+
});
|
|
48
|
+
it('displays pre-selects branches correctly', async () => {
|
|
49
|
+
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
50
|
+
'--repo=backport-org/repo-with-changing-branchLabelMapping',
|
|
51
|
+
'--no-fork',
|
|
52
|
+
'--pr=6',
|
|
53
|
+
`--accessToken=${accessToken}`,
|
|
54
|
+
], { waitForString: 'Select branch' });
|
|
55
|
+
expect(output).toMatchInlineSnapshot(`
|
|
56
|
+
"? Select branch (Press <space> to select, <a> to toggle all, <i> to invert
|
|
57
|
+
selection, and <enter> to proceed)
|
|
58
|
+
❯◯ 8.4
|
|
59
|
+
◉ 8.3
|
|
60
|
+
◉ 8.2
|
|
61
|
+
◉ production"
|
|
62
|
+
`);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
describe('for commit merged after branchLabelMapping was changed', () => {
|
|
67
|
+
describe('CLI', () => {
|
|
68
|
+
let commit;
|
|
69
|
+
beforeAll(async () => {
|
|
70
|
+
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
71
|
+
'--repo=backport-org/repo-with-changing-branchLabelMapping',
|
|
72
|
+
'--no-fork',
|
|
73
|
+
`--accessToken=${accessToken}`,
|
|
74
|
+
'--json',
|
|
75
|
+
'--ls',
|
|
76
|
+
]);
|
|
77
|
+
commit = JSON.parse(output).commits[0];
|
|
78
|
+
});
|
|
79
|
+
it('suggests "production" as target branch', async () => {
|
|
80
|
+
expect(commit.suggestedTargetBranches).toContain('production');
|
|
81
|
+
});
|
|
82
|
+
it('shows "production" as NOT_CREATED', () => {
|
|
83
|
+
expect(commit.pullRequestStates.map(({ branch, label, state }) => ({
|
|
84
|
+
branch,
|
|
85
|
+
label,
|
|
86
|
+
state,
|
|
87
|
+
}))).toContainEqual({
|
|
88
|
+
branch: 'production',
|
|
89
|
+
label: 'backport-to-production',
|
|
90
|
+
state: 'NOT_CREATED',
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -51,13 +51,15 @@ describe('entrypoint.module', () => {
|
|
|
51
51
|
commits: [
|
|
52
52
|
{
|
|
53
53
|
author: { email: 'sorenlouv@gmail.com', name: 'Søren Louv-Jansen' },
|
|
54
|
-
|
|
54
|
+
pullRequestStates: [],
|
|
55
55
|
sourceBranch: 'master',
|
|
56
56
|
sourceCommit: {
|
|
57
57
|
committedDate: '2020-08-15T10:37:41Z',
|
|
58
58
|
message: 'Add ❤️ emoji',
|
|
59
59
|
sha: COMMIT_SHA_1,
|
|
60
|
+
branchLabelMapping: undefined,
|
|
60
61
|
},
|
|
62
|
+
suggestedTargetBranches: [],
|
|
61
63
|
sourcePullRequest: undefined,
|
|
62
64
|
},
|
|
63
65
|
],
|
|
@@ -147,18 +149,21 @@ describe('entrypoint.module', () => {
|
|
|
147
149
|
commits: [
|
|
148
150
|
{
|
|
149
151
|
author: { email: 'sorenlouv@gmail.com', name: 'Søren Louv-Jansen' },
|
|
150
|
-
|
|
152
|
+
pullRequestStates: [],
|
|
151
153
|
sourceBranch: 'master',
|
|
152
154
|
sourceCommit: {
|
|
153
155
|
committedDate: '2020-08-15T10:37:41Z',
|
|
154
156
|
message: 'Add ❤️ emoji',
|
|
155
157
|
sha: COMMIT_SHA_1,
|
|
158
|
+
branchLabelMapping: undefined,
|
|
156
159
|
},
|
|
160
|
+
suggestedTargetBranches: [],
|
|
157
161
|
sourcePullRequest: undefined,
|
|
158
162
|
},
|
|
159
163
|
{
|
|
160
164
|
author: { email: 'sorenlouv@gmail.com', name: 'Søren Louv-Jansen' },
|
|
161
|
-
|
|
165
|
+
suggestedTargetBranches: [],
|
|
166
|
+
pullRequestStates: [],
|
|
162
167
|
sourceBranch: 'master',
|
|
163
168
|
sourceCommit: {
|
|
164
169
|
committedDate: '2020-08-15T10:44:04Z',
|
|
@@ -258,13 +263,15 @@ describe('entrypoint.module', () => {
|
|
|
258
263
|
commits: [
|
|
259
264
|
{
|
|
260
265
|
author: { email: 'sorenlouv@gmail.com', name: 'Søren Louv-Jansen' },
|
|
261
|
-
|
|
266
|
+
pullRequestStates: [],
|
|
262
267
|
sourceBranch: 'master',
|
|
263
268
|
sourceCommit: {
|
|
264
269
|
committedDate: '2020-08-15T10:37:41Z',
|
|
265
270
|
message: 'Add ❤️ emoji',
|
|
266
271
|
sha: COMMIT_SHA_1,
|
|
272
|
+
branchLabelMapping: undefined,
|
|
267
273
|
},
|
|
274
|
+
suggestedTargetBranches: [],
|
|
268
275
|
sourcePullRequest: undefined,
|
|
269
276
|
},
|
|
270
277
|
],
|
|
@@ -17,6 +17,7 @@ describe('Handle unbackported pull requests', () => {
|
|
|
17
17
|
const expectedCommit = {
|
|
18
18
|
author: { email: 'sorenlouv@gmail.com', name: 'Søren Louv-Jansen' },
|
|
19
19
|
sourceCommit: {
|
|
20
|
+
branchLabelMapping: undefined,
|
|
20
21
|
committedDate: '2021-12-16T00:03:34Z',
|
|
21
22
|
message: 'Change Barca to Braithwaite (#8)',
|
|
22
23
|
sha: '343402a748be2375325b2730fa979bcea5b96ba1',
|
|
@@ -29,8 +30,16 @@ describe('Handle unbackported pull requests', () => {
|
|
|
29
30
|
sha: '343402a748be2375325b2730fa979bcea5b96ba1',
|
|
30
31
|
},
|
|
31
32
|
},
|
|
33
|
+
suggestedTargetBranches: ['7.x'],
|
|
32
34
|
sourceBranch: 'main',
|
|
33
|
-
|
|
35
|
+
pullRequestStates: [
|
|
36
|
+
{
|
|
37
|
+
branch: '7.x',
|
|
38
|
+
label: 'backport-to-7.x',
|
|
39
|
+
isSourceBranch: false,
|
|
40
|
+
state: 'NOT_CREATED',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
34
43
|
};
|
|
35
44
|
expect(commits[0]).toEqual(expectedCommit);
|
|
36
45
|
});
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.filterUnmergedCommits = void 0;
|
|
4
4
|
function filterUnmergedCommits(commit) {
|
|
5
|
-
return commit.
|
|
5
|
+
return commit.pullRequestStates.some((pr) => pr.state !== 'MERGED');
|
|
6
6
|
}
|
|
7
7
|
exports.filterUnmergedCommits = filterUnmergedCommits;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "8.
|
|
1
|
+
export declare const PACKAGE_VERSION = "8.5.0";
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"branches",
|
|
15
15
|
"branching"
|
|
16
16
|
],
|
|
17
|
-
"version": "8.
|
|
17
|
+
"version": "8.5.0",
|
|
18
18
|
"main": "./dist/entrypoint.module.js",
|
|
19
19
|
"types": "dist/entrypoint.module.d.ts",
|
|
20
20
|
"bin": {
|
|
@@ -87,29 +87,29 @@
|
|
|
87
87
|
"@types/core-js": "^2.5.5",
|
|
88
88
|
"@types/dedent": "^0.7.0",
|
|
89
89
|
"@types/inquirer": "^8.2.1",
|
|
90
|
-
"@types/jest": "^
|
|
90
|
+
"@types/jest": "^28.1.1",
|
|
91
91
|
"@types/lodash": "^4.14.182",
|
|
92
|
-
"@types/node": "^17.0.
|
|
92
|
+
"@types/node": "^17.0.41",
|
|
93
93
|
"@types/safe-json-stringify": "^1.1.2",
|
|
94
94
|
"@types/yargs": "^17.0.10",
|
|
95
95
|
"@types/yargs-parser": "^21.0.0",
|
|
96
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
97
|
-
"@typescript-eslint/parser": "^5.
|
|
98
|
-
"eslint": "^8.
|
|
96
|
+
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
|
97
|
+
"@typescript-eslint/parser": "^5.27.1",
|
|
98
|
+
"eslint": "^8.17.0",
|
|
99
99
|
"eslint-config-prettier": "^8.5.0",
|
|
100
100
|
"eslint-plugin-import": "^2.26.0",
|
|
101
|
-
"eslint-plugin-jest": "^26.
|
|
101
|
+
"eslint-plugin-jest": "^26.5.3",
|
|
102
102
|
"eslint-plugin-prettier": "^4.0.0",
|
|
103
103
|
"graphql-config": "^4.3.1",
|
|
104
104
|
"husky": "^8.0.1",
|
|
105
|
-
"jest": "^28.1.
|
|
105
|
+
"jest": "^28.1.1",
|
|
106
106
|
"jest-snapshot-serializer-ansi": "^1.0.0",
|
|
107
|
-
"lint-staged": "^
|
|
108
|
-
"nock": "^13.2.
|
|
107
|
+
"lint-staged": "^13.0.0",
|
|
108
|
+
"nock": "^13.2.6",
|
|
109
109
|
"prettier": "^2.6.2",
|
|
110
110
|
"strip-ansi": "^6.0.1",
|
|
111
|
-
"ts-jest": "^28.0.
|
|
112
|
-
"ts-node": "^10.8.
|
|
113
|
-
"typescript": "^4.7.
|
|
111
|
+
"ts-jest": "^28.0.4",
|
|
112
|
+
"ts-node": "^10.8.1",
|
|
113
|
+
"typescript": "^4.7.3"
|
|
114
114
|
}
|
|
115
115
|
}
|