backport 8.4.2 → 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/author.d.ts +13 -0
- package/dist/lib/author.js +28 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.js +14 -20
- package/dist/lib/cherrypickAndCreateTargetPullRequest.test.js +14 -4
- package/dist/lib/child-process-promisified.d.ts +1 -1
- package/dist/lib/child-process-promisified.js +14 -3
- 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 +9 -7
- package/dist/lib/git.js +12 -4
- package/dist/lib/git.private.test.js +21 -4
- package/dist/lib/git.test.js +31 -7
- 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/setupRepo.test.js +5 -5
- 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/cli/runBackportViaCli.js +1 -1
- package/dist/test/e2e/module/entrypoint.module.mutation.test.js +11 -4
- package/dist/test/handleUnbackportedPullRequests.private.test.js +10 -1
- package/dist/test/sandbox.d.ts +1 -0
- package/dist/test/sandbox.js +3 -2
- 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 +15 -15
- package/yarn.lock +561 -471
- package/dist/lib/getGitConfigAuthor.d.ts +0 -6
- package/dist/lib/getGitConfigAuthor.js +0 -15
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.d.ts +0 -16
|
@@ -19,12 +19,14 @@ describe('getPullRequestBody', () => {
|
|
|
19
19
|
message: 'My commit message (#55)',
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
|
+
suggestedTargetBranches: [],
|
|
22
23
|
sourceCommit: {
|
|
24
|
+
branchLabelMapping: {},
|
|
23
25
|
committedDate: '2020',
|
|
24
26
|
sha: 'abcdefghi',
|
|
25
27
|
message: 'My commit message (#55)',
|
|
26
28
|
},
|
|
27
|
-
|
|
29
|
+
pullRequestStates: [],
|
|
28
30
|
sourceBranch: 'master',
|
|
29
31
|
},
|
|
30
32
|
],
|
|
@@ -50,13 +52,15 @@ describe('getPullRequestBody', () => {
|
|
|
50
52
|
email: 'soren.louv@elastic.co',
|
|
51
53
|
name: 'Søren Louv-Jansen',
|
|
52
54
|
},
|
|
55
|
+
suggestedTargetBranches: [],
|
|
53
56
|
sourceCommit: {
|
|
57
|
+
branchLabelMapping: {},
|
|
54
58
|
committedDate: '',
|
|
55
59
|
sha: 'abcdefghijklmw',
|
|
56
60
|
message: 'My commit message',
|
|
57
61
|
},
|
|
58
62
|
sourceBranch: 'main',
|
|
59
|
-
|
|
63
|
+
pullRequestStates: [],
|
|
60
64
|
},
|
|
61
65
|
],
|
|
62
66
|
targetBranch: '7.x',
|
|
@@ -89,26 +93,30 @@ describe('getPullRequestBody', () => {
|
|
|
89
93
|
message: 'My commit message (#55)',
|
|
90
94
|
},
|
|
91
95
|
},
|
|
96
|
+
suggestedTargetBranches: [],
|
|
92
97
|
sourceCommit: {
|
|
98
|
+
branchLabelMapping: {},
|
|
93
99
|
committedDate: '',
|
|
94
100
|
sha: 'abcdefghijklm',
|
|
95
101
|
message: 'My commit message (#55)',
|
|
96
102
|
},
|
|
97
103
|
sourceBranch: 'main',
|
|
98
|
-
|
|
104
|
+
pullRequestStates: [],
|
|
99
105
|
},
|
|
100
106
|
{
|
|
101
107
|
author: {
|
|
102
108
|
email: 'soren.louv@elastic.co',
|
|
103
109
|
name: 'Søren Louv-Jansen',
|
|
104
110
|
},
|
|
111
|
+
suggestedTargetBranches: [],
|
|
105
112
|
sourceCommit: {
|
|
113
|
+
branchLabelMapping: {},
|
|
106
114
|
committedDate: '',
|
|
107
115
|
sha: 'qwertyuiop',
|
|
108
116
|
message: 'Another commit message',
|
|
109
117
|
},
|
|
110
118
|
sourceBranch: 'main',
|
|
111
|
-
|
|
119
|
+
pullRequestStates: [],
|
|
112
120
|
},
|
|
113
121
|
],
|
|
114
122
|
targetBranch: '7.x',
|
|
@@ -130,7 +138,9 @@ describe('getPullRequestBody', () => {
|
|
|
130
138
|
options: {},
|
|
131
139
|
commits: [
|
|
132
140
|
{
|
|
141
|
+
suggestedTargetBranches: [],
|
|
133
142
|
sourceCommit: {
|
|
143
|
+
branchLabelMapping: {},
|
|
134
144
|
committedDate: '2022-02-07T23:53:14Z',
|
|
135
145
|
message: 'Merge strategy: Second commit',
|
|
136
146
|
sha: 'e8df5eaa4db7b94474b48e2320b02d33a830d9fb',
|
|
@@ -148,10 +158,12 @@ describe('getPullRequestBody', () => {
|
|
|
148
158
|
},
|
|
149
159
|
},
|
|
150
160
|
sourceBranch: 'main',
|
|
151
|
-
|
|
161
|
+
pullRequestStates: [],
|
|
152
162
|
},
|
|
153
163
|
{
|
|
164
|
+
suggestedTargetBranches: [],
|
|
154
165
|
sourceCommit: {
|
|
166
|
+
branchLabelMapping: {},
|
|
155
167
|
committedDate: '2022-02-07T23:51:59Z',
|
|
156
168
|
message: 'Merge strategy: First commit',
|
|
157
169
|
sha: '5411b1c1144093e422220008f23f2c2b909ed113',
|
|
@@ -169,7 +181,7 @@ describe('getPullRequestBody', () => {
|
|
|
169
181
|
},
|
|
170
182
|
},
|
|
171
183
|
sourceBranch: 'main',
|
|
172
|
-
|
|
184
|
+
pullRequestStates: [],
|
|
173
185
|
},
|
|
174
186
|
],
|
|
175
187
|
targetBranch: '7.x',
|
|
@@ -205,26 +217,30 @@ describe('getPullRequestBody', () => {
|
|
|
205
217
|
message: 'My commit message (#55)',
|
|
206
218
|
},
|
|
207
219
|
},
|
|
220
|
+
suggestedTargetBranches: [],
|
|
208
221
|
sourceCommit: {
|
|
222
|
+
branchLabelMapping: {},
|
|
209
223
|
committedDate: '',
|
|
210
224
|
sha: 'abcdefghijklm',
|
|
211
225
|
message: 'My commit message (#55)',
|
|
212
226
|
},
|
|
213
227
|
sourceBranch: 'main',
|
|
214
|
-
|
|
228
|
+
pullRequestStates: [],
|
|
215
229
|
},
|
|
216
230
|
{
|
|
217
231
|
author: {
|
|
218
232
|
email: 'soren.louv@elastic.co',
|
|
219
233
|
name: 'Søren Louv-Jansen',
|
|
220
234
|
},
|
|
235
|
+
suggestedTargetBranches: [],
|
|
221
236
|
sourceCommit: {
|
|
237
|
+
branchLabelMapping: {},
|
|
222
238
|
committedDate: '',
|
|
223
239
|
sha: 'qwertyuiop',
|
|
224
240
|
message: 'Another commit message',
|
|
225
241
|
},
|
|
226
242
|
sourceBranch: 'main',
|
|
227
|
-
|
|
243
|
+
pullRequestStates: [],
|
|
228
244
|
},
|
|
229
245
|
],
|
|
230
246
|
targetBranch: '7.x',
|
|
@@ -253,26 +269,30 @@ describe('getPullRequestBody', () => {
|
|
|
253
269
|
message: 'My commit message (#55)',
|
|
254
270
|
},
|
|
255
271
|
},
|
|
272
|
+
suggestedTargetBranches: [],
|
|
256
273
|
sourceCommit: {
|
|
274
|
+
branchLabelMapping: {},
|
|
257
275
|
committedDate: '',
|
|
258
276
|
sha: 'abcdefghijklm',
|
|
259
277
|
message: 'My commit message (#55)',
|
|
260
278
|
},
|
|
261
279
|
sourceBranch: 'main',
|
|
262
|
-
|
|
280
|
+
pullRequestStates: [],
|
|
263
281
|
},
|
|
264
282
|
{
|
|
265
283
|
author: {
|
|
266
284
|
email: 'soren.louv@elastic.co',
|
|
267
285
|
name: 'Søren Louv-Jansen',
|
|
268
286
|
},
|
|
287
|
+
suggestedTargetBranches: [],
|
|
269
288
|
sourceCommit: {
|
|
289
|
+
branchLabelMapping: {},
|
|
270
290
|
committedDate: '',
|
|
271
291
|
sha: 'qwertyuiop',
|
|
272
292
|
message: 'Another commit message',
|
|
273
293
|
},
|
|
274
294
|
sourceBranch: 'main',
|
|
275
|
-
|
|
295
|
+
pullRequestStates: [],
|
|
276
296
|
},
|
|
277
297
|
],
|
|
278
298
|
targetBranch: '7.x',
|
|
@@ -311,12 +331,14 @@ describe('getTitle', () => {
|
|
|
311
331
|
message: 'My commit message (#55)',
|
|
312
332
|
},
|
|
313
333
|
},
|
|
334
|
+
suggestedTargetBranches: [],
|
|
314
335
|
sourceCommit: {
|
|
336
|
+
branchLabelMapping: {},
|
|
315
337
|
committedDate: '2020',
|
|
316
338
|
sha: 'abcdefghi',
|
|
317
339
|
message: 'My commit message (#55)',
|
|
318
340
|
},
|
|
319
|
-
|
|
341
|
+
pullRequestStates: [],
|
|
320
342
|
},
|
|
321
343
|
{
|
|
322
344
|
author: {
|
|
@@ -331,13 +353,15 @@ describe('getTitle', () => {
|
|
|
331
353
|
message: 'Another commit message (#56)',
|
|
332
354
|
},
|
|
333
355
|
},
|
|
356
|
+
suggestedTargetBranches: [],
|
|
334
357
|
sourceCommit: {
|
|
358
|
+
branchLabelMapping: {},
|
|
335
359
|
committedDate: '2020',
|
|
336
360
|
sha: 'jklmnopqr',
|
|
337
361
|
message: 'Another commit message (#56)',
|
|
338
362
|
},
|
|
339
363
|
sourceBranch: 'main',
|
|
340
|
-
|
|
364
|
+
pullRequestStates: [],
|
|
341
365
|
},
|
|
342
366
|
],
|
|
343
367
|
targetBranch: '7.x',
|
|
@@ -362,13 +386,15 @@ describe('getTitle', () => {
|
|
|
362
386
|
message: 'My commit message (#55)',
|
|
363
387
|
},
|
|
364
388
|
},
|
|
389
|
+
suggestedTargetBranches: [],
|
|
365
390
|
sourceCommit: {
|
|
391
|
+
branchLabelMapping: {},
|
|
366
392
|
committedDate: '',
|
|
367
393
|
sha: 'abcdefghi',
|
|
368
394
|
message: 'My commit message (#55)',
|
|
369
395
|
},
|
|
370
396
|
sourceBranch: 'main',
|
|
371
|
-
|
|
397
|
+
pullRequestStates: [],
|
|
372
398
|
},
|
|
373
399
|
],
|
|
374
400
|
targetBranch: '7.x',
|
|
@@ -100,11 +100,14 @@ ${manualBackportCommand}${questionsAndLinkToBackport}${packageVersionSection}`;
|
|
|
100
100
|
});
|
|
101
101
|
const unmergedBackportsSection = unmergedBackports.length > 0
|
|
102
102
|
? `<br><br>You might need to backport the following PRs to ${result.targetBranch}:<br>${unmergedBackports.join('<br>')}`
|
|
103
|
-
:
|
|
103
|
+
: undefined;
|
|
104
|
+
const backportFailedLabel = 'Backport failed because of merge conflicts';
|
|
104
105
|
return [
|
|
105
106
|
'❌',
|
|
106
107
|
result.targetBranch,
|
|
107
|
-
|
|
108
|
+
unmergedBackportsSection
|
|
109
|
+
? `**${backportFailedLabel}**${unmergedBackportsSection}`
|
|
110
|
+
: backportFailedLabel,
|
|
108
111
|
];
|
|
109
112
|
}
|
|
110
113
|
const message = result.status === 'handled-error'
|
|
@@ -279,12 +279,14 @@ describe('getCommentBody', () => {
|
|
|
279
279
|
message: 'New Zealand commit message',
|
|
280
280
|
},
|
|
281
281
|
},
|
|
282
|
+
suggestedTargetBranches: [],
|
|
282
283
|
sourceCommit: {
|
|
284
|
+
branchLabelMapping: {},
|
|
283
285
|
committedDate: '',
|
|
284
286
|
sha: '',
|
|
285
287
|
message: 'New Zealand commit message',
|
|
286
288
|
},
|
|
287
|
-
|
|
289
|
+
pullRequestStates: [],
|
|
288
290
|
},
|
|
289
291
|
},
|
|
290
292
|
{
|
|
@@ -303,12 +305,14 @@ describe('getCommentBody', () => {
|
|
|
303
305
|
message: 'Australia commit',
|
|
304
306
|
},
|
|
305
307
|
},
|
|
308
|
+
suggestedTargetBranches: [],
|
|
306
309
|
sourceCommit: {
|
|
310
|
+
branchLabelMapping: {},
|
|
307
311
|
committedDate: '',
|
|
308
312
|
sha: '',
|
|
309
313
|
message: 'Australia commit',
|
|
310
314
|
},
|
|
311
|
-
|
|
315
|
+
pullRequestStates: [],
|
|
312
316
|
},
|
|
313
317
|
},
|
|
314
318
|
],
|
|
@@ -335,7 +339,7 @@ describe('getCommentBody', () => {
|
|
|
335
339
|
|:------:|:------:|:------|
|
|
336
340
|
|✅|7.x|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/55\\">](url-to-pr-55)|
|
|
337
341
|
|❌|7.1|**Backport failed because of merge conflicts**<br><br>You might need to backport the following PRs to 7.1:<br> - [New Zealand commit message](url-to-pr-5)<br> - [Australia commit](url-to-pr-44)|
|
|
338
|
-
|❌|7.2
|
|
342
|
+
|❌|7.2|Backport failed because of merge conflicts|
|
|
339
343
|
|
|
340
344
|
Note: Successful backport PRs will be merged automatically after passing CI.
|
|
341
345
|
|
|
@@ -64,7 +64,12 @@ describe('allFetchers', () => {
|
|
|
64
64
|
it('returns correct response for commitByAuthor', async () => {
|
|
65
65
|
const expectedCommit = {
|
|
66
66
|
author: { email: 'soren.louv@elastic.co', name: 'Søren Louv-Jansen' },
|
|
67
|
+
suggestedTargetBranches: [],
|
|
67
68
|
sourceCommit: {
|
|
69
|
+
branchLabelMapping: {
|
|
70
|
+
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
71
|
+
'^v8.1.0$': 'main',
|
|
72
|
+
},
|
|
68
73
|
committedDate: '2021-12-20T14:20:16Z',
|
|
69
74
|
message: '[APM] Add note about synthtrace to APM docs (#121633)',
|
|
70
75
|
sha: 'd421ddcf6157150596581c7885afa3690cec6339',
|
|
@@ -78,9 +83,11 @@ describe('allFetchers', () => {
|
|
|
78
83
|
},
|
|
79
84
|
},
|
|
80
85
|
sourceBranch: 'main',
|
|
81
|
-
|
|
86
|
+
pullRequestStates: [
|
|
82
87
|
{
|
|
83
88
|
branch: '8.0',
|
|
89
|
+
label: 'v8.0.0',
|
|
90
|
+
isSourceBranch: false,
|
|
84
91
|
mergeCommit: {
|
|
85
92
|
message: '[APM] Add note about synthtrace to APM docs (#121633) (#121643)\n\nCo-authored-by: Søren Louv-Jansen <soren.louv@elastic.co>',
|
|
86
93
|
sha: '842adfdeb5541b059231857522f9009771a46107',
|
|
@@ -89,6 +96,18 @@ describe('allFetchers', () => {
|
|
|
89
96
|
state: 'MERGED',
|
|
90
97
|
url: 'https://github.com/elastic/kibana/pull/121643',
|
|
91
98
|
},
|
|
99
|
+
{
|
|
100
|
+
branch: 'main',
|
|
101
|
+
label: 'v8.1.0',
|
|
102
|
+
isSourceBranch: true,
|
|
103
|
+
mergeCommit: {
|
|
104
|
+
message: '[APM] Add note about synthtrace to APM docs (#121633)',
|
|
105
|
+
sha: 'd421ddcf6157150596581c7885afa3690cec6339',
|
|
106
|
+
},
|
|
107
|
+
number: 121633,
|
|
108
|
+
state: 'MERGED',
|
|
109
|
+
url: 'https://github.com/elastic/kibana/pull/121633',
|
|
110
|
+
},
|
|
92
111
|
],
|
|
93
112
|
};
|
|
94
113
|
expect(commitByAuthor).toEqual(expectedCommit);
|
|
@@ -69,7 +69,13 @@ describe('fetchCommitByPullNumber', () => {
|
|
|
69
69
|
};
|
|
70
70
|
const expectedCommit = {
|
|
71
71
|
author: { email: 'sorenlouv@gmail.com', name: 'Søren Louv-Jansen' },
|
|
72
|
+
suggestedTargetBranches: [],
|
|
72
73
|
sourceCommit: {
|
|
74
|
+
branchLabelMapping: {
|
|
75
|
+
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
76
|
+
'^v7.9.0$': '7.x',
|
|
77
|
+
'^v8.0.0$': 'master',
|
|
78
|
+
},
|
|
73
79
|
committedDate: '2020-08-15T12:40:19Z',
|
|
74
80
|
message: 'Add 🍏 emoji (#5)',
|
|
75
81
|
sha: 'ee8c492334cef1ca077a56addb79a26f79821d2f',
|
|
@@ -83,26 +89,42 @@ describe('fetchCommitByPullNumber', () => {
|
|
|
83
89
|
},
|
|
84
90
|
},
|
|
85
91
|
sourceBranch: 'master',
|
|
86
|
-
|
|
92
|
+
pullRequestStates: [
|
|
87
93
|
{
|
|
88
|
-
branch: '7.
|
|
94
|
+
branch: '7.8',
|
|
95
|
+
isSourceBranch: false,
|
|
96
|
+
label: 'v7.8.0',
|
|
97
|
+
mergeCommit: {
|
|
98
|
+
message: 'Add 🍏 emoji (#5) (#7)',
|
|
99
|
+
sha: '46cd6f9999effdf894a36dbc7db90e890f4be840',
|
|
100
|
+
},
|
|
101
|
+
number: 7,
|
|
89
102
|
state: 'MERGED',
|
|
90
|
-
|
|
91
|
-
|
|
103
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/7',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
branch: '7.x',
|
|
107
|
+
isSourceBranch: false,
|
|
108
|
+
label: 'v7.9.0',
|
|
92
109
|
mergeCommit: {
|
|
93
110
|
message: 'Add 🍏 emoji (#5) (#6)',
|
|
94
111
|
sha: '4bcd876d4ceaa73cf437bfc89b74d1a4e704c0a6',
|
|
95
112
|
},
|
|
113
|
+
number: 6,
|
|
114
|
+
state: 'MERGED',
|
|
115
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/6',
|
|
96
116
|
},
|
|
97
117
|
{
|
|
98
|
-
branch: '
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
url: 'https://github.com/backport-org/backport-e2e/pull/7',
|
|
118
|
+
branch: 'master',
|
|
119
|
+
isSourceBranch: true,
|
|
120
|
+
label: 'v8.0.0',
|
|
102
121
|
mergeCommit: {
|
|
103
|
-
message: 'Add 🍏 emoji (#5)
|
|
104
|
-
sha: '
|
|
122
|
+
message: 'Add 🍏 emoji (#5)',
|
|
123
|
+
sha: 'ee8c492334cef1ca077a56addb79a26f79821d2f',
|
|
105
124
|
},
|
|
125
|
+
number: 5,
|
|
126
|
+
state: 'MERGED',
|
|
127
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/5',
|
|
106
128
|
},
|
|
107
129
|
],
|
|
108
130
|
};
|
|
@@ -62,7 +62,13 @@ describe('fetchCommitBySha', () => {
|
|
|
62
62
|
it('should return single commit with pull request', async () => {
|
|
63
63
|
const expectedCommit = {
|
|
64
64
|
author: { email: 'sorenlouv@gmail.com', name: 'Søren Louv-Jansen' },
|
|
65
|
+
suggestedTargetBranches: [],
|
|
65
66
|
sourceCommit: {
|
|
67
|
+
branchLabelMapping: {
|
|
68
|
+
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
69
|
+
'^v7.9.0$': '7.x',
|
|
70
|
+
'^v8.0.0$': 'master',
|
|
71
|
+
},
|
|
66
72
|
committedDate: '2020-07-07T20:40:28Z',
|
|
67
73
|
message: '[APM] Add API tests (#70740)',
|
|
68
74
|
sha: 'cb6fbc0e1b406675724181a3e9f59459b5f8f892',
|
|
@@ -76,9 +82,11 @@ describe('fetchCommitBySha', () => {
|
|
|
76
82
|
},
|
|
77
83
|
},
|
|
78
84
|
sourceBranch: 'master',
|
|
79
|
-
|
|
85
|
+
pullRequestStates: [
|
|
80
86
|
{
|
|
81
87
|
branch: '7.x',
|
|
88
|
+
label: 'v7.9.0',
|
|
89
|
+
isSourceBranch: false,
|
|
82
90
|
state: 'MERGED',
|
|
83
91
|
number: 71014,
|
|
84
92
|
url: 'https://github.com/elastic/kibana/pull/71014',
|
|
@@ -135,7 +135,7 @@ describe('fetchCommitsByAuthor', () => {
|
|
|
135
135
|
]);
|
|
136
136
|
});
|
|
137
137
|
});
|
|
138
|
-
describe('
|
|
138
|
+
describe('pullRequestStates', () => {
|
|
139
139
|
let res;
|
|
140
140
|
beforeEach(async () => {
|
|
141
141
|
res = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
@@ -152,9 +152,11 @@ describe('fetchCommitsByAuthor', () => {
|
|
|
152
152
|
});
|
|
153
153
|
it('returns related OPEN PRs', async () => {
|
|
154
154
|
const commitWithOpenPR = res.find((commit) => commit.sourcePullRequest?.number === 9);
|
|
155
|
-
expect(commitWithOpenPR?.
|
|
155
|
+
expect(commitWithOpenPR?.pullRequestStates).toEqual([
|
|
156
156
|
{
|
|
157
157
|
branch: '7.8',
|
|
158
|
+
label: 'v7.8.0',
|
|
159
|
+
isSourceBranch: false,
|
|
158
160
|
state: 'OPEN',
|
|
159
161
|
number: 10,
|
|
160
162
|
url: 'https://github.com/backport-org/backport-e2e/pull/10',
|
|
@@ -163,33 +165,66 @@ describe('fetchCommitsByAuthor', () => {
|
|
|
163
165
|
});
|
|
164
166
|
it('returns related MERGED PRs', async () => {
|
|
165
167
|
const commitWithMergedPRs = res.find((commit) => commit.sourcePullRequest?.number === 5);
|
|
166
|
-
expect(commitWithMergedPRs?.
|
|
168
|
+
expect(commitWithMergedPRs?.pullRequestStates).toEqual([
|
|
167
169
|
{
|
|
168
|
-
branch: '7.
|
|
170
|
+
branch: '7.8',
|
|
171
|
+
label: 'v7.8.0',
|
|
172
|
+
isSourceBranch: false,
|
|
173
|
+
mergeCommit: {
|
|
174
|
+
message: 'Add 🍏 emoji (#5) (#7)',
|
|
175
|
+
sha: '46cd6f9999effdf894a36dbc7db90e890f4be840',
|
|
176
|
+
},
|
|
177
|
+
number: 7,
|
|
169
178
|
state: 'MERGED',
|
|
170
|
-
|
|
171
|
-
|
|
179
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/7',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
branch: '7.x',
|
|
183
|
+
label: 'v7.9.0',
|
|
184
|
+
isSourceBranch: false,
|
|
172
185
|
mergeCommit: {
|
|
173
186
|
message: 'Add 🍏 emoji (#5) (#6)',
|
|
174
187
|
sha: '4bcd876d4ceaa73cf437bfc89b74d1a4e704c0a6',
|
|
175
188
|
},
|
|
189
|
+
number: 6,
|
|
190
|
+
state: 'MERGED',
|
|
191
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/6',
|
|
176
192
|
},
|
|
177
193
|
{
|
|
178
|
-
branch: '
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
url: 'https://github.com/backport-org/backport-e2e/pull/7',
|
|
194
|
+
branch: 'master',
|
|
195
|
+
label: 'v8.0.0',
|
|
196
|
+
isSourceBranch: true,
|
|
182
197
|
mergeCommit: {
|
|
183
|
-
message: 'Add 🍏 emoji (#5)
|
|
184
|
-
sha: '
|
|
198
|
+
message: 'Add 🍏 emoji (#5)',
|
|
199
|
+
sha: 'ee8c492334cef1ca077a56addb79a26f79821d2f',
|
|
185
200
|
},
|
|
201
|
+
number: 5,
|
|
202
|
+
state: 'MERGED',
|
|
203
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/5',
|
|
186
204
|
},
|
|
187
205
|
]);
|
|
188
206
|
});
|
|
189
207
|
it('returns missing pull requests', async () => {
|
|
190
208
|
const commitWithoutPRs = res.find((commit) => commit.sourcePullRequest?.number === 8);
|
|
191
|
-
expect(commitWithoutPRs?.
|
|
192
|
-
{
|
|
209
|
+
expect(commitWithoutPRs?.pullRequestStates).toEqual([
|
|
210
|
+
{
|
|
211
|
+
branch: '7.x',
|
|
212
|
+
label: 'v7.9.0',
|
|
213
|
+
isSourceBranch: false,
|
|
214
|
+
state: 'NOT_CREATED',
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
branch: 'master',
|
|
218
|
+
label: 'v8.0.0',
|
|
219
|
+
isSourceBranch: true,
|
|
220
|
+
mergeCommit: {
|
|
221
|
+
message: 'Change Ulysses to Gretha (conflict) (#8)',
|
|
222
|
+
sha: 'b484e161b705b39dbbfc5005e67ca24d05b23c37',
|
|
223
|
+
},
|
|
224
|
+
number: 8,
|
|
225
|
+
state: 'MERGED',
|
|
226
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/8',
|
|
227
|
+
},
|
|
193
228
|
]);
|
|
194
229
|
});
|
|
195
230
|
});
|
|
@@ -47,17 +47,21 @@ describe('fetchCommitsByAuthor', () => {
|
|
|
47
47
|
const expectedCommits = [
|
|
48
48
|
{
|
|
49
49
|
author: { email: 'soren.louv@elastic.co', name: 'Søren Louv-Jansen' },
|
|
50
|
+
suggestedTargetBranches: [],
|
|
50
51
|
sourceCommit: {
|
|
52
|
+
branchLabelMapping: undefined,
|
|
51
53
|
committedDate: '2021-12-24T00:00:00Z',
|
|
52
54
|
sha: '2e63475c483f7844b0f2833bc57fdee32095bacb',
|
|
53
55
|
message: 'Add 👻',
|
|
54
56
|
},
|
|
55
|
-
|
|
57
|
+
pullRequestStates: [],
|
|
56
58
|
sourceBranch: 'source-branch-from-options',
|
|
57
59
|
},
|
|
58
60
|
{
|
|
59
61
|
author: { email: 'soren.louv@elastic.co', name: 'Søren Louv-Jansen' },
|
|
62
|
+
suggestedTargetBranches: [],
|
|
60
63
|
sourceCommit: {
|
|
64
|
+
branchLabelMapping: undefined,
|
|
61
65
|
committedDate: '2021-12-23T00:00:00Z',
|
|
62
66
|
sha: 'f3b618b9421fdecdb36862f907afbdd6344b361d',
|
|
63
67
|
message: 'Add witch (#85)',
|
|
@@ -70,12 +74,14 @@ describe('fetchCommitsByAuthor', () => {
|
|
|
70
74
|
message: 'Add witch (#85)',
|
|
71
75
|
},
|
|
72
76
|
},
|
|
73
|
-
|
|
77
|
+
pullRequestStates: [],
|
|
74
78
|
sourceBranch: 'master',
|
|
75
79
|
},
|
|
76
80
|
{
|
|
77
81
|
author: { email: 'soren.louv@elastic.co', name: 'Søren Louv-Jansen' },
|
|
82
|
+
suggestedTargetBranches: [],
|
|
78
83
|
sourceCommit: {
|
|
84
|
+
branchLabelMapping: undefined,
|
|
79
85
|
committedDate: '2021-12-22T00:00:00Z',
|
|
80
86
|
sha: '79cf18453ec32a4677009dcbab1c9c8c73fc14fe',
|
|
81
87
|
message: 'Add SF mention (#80)\n\n* Add SF mention\r\n\r\n* Add several emojis!',
|
|
@@ -88,7 +94,7 @@ describe('fetchCommitsByAuthor', () => {
|
|
|
88
94
|
message: 'Add SF mention (#80)\n\n* Add SF mention\r\n\r\n* Add several emojis!',
|
|
89
95
|
},
|
|
90
96
|
},
|
|
91
|
-
|
|
97
|
+
pullRequestStates: [
|
|
92
98
|
{
|
|
93
99
|
branch: '6.3',
|
|
94
100
|
state: 'MERGED',
|
|
@@ -104,22 +110,26 @@ describe('fetchCommitsByAuthor', () => {
|
|
|
104
110
|
},
|
|
105
111
|
{
|
|
106
112
|
author: { email: 'soren.louv@elastic.co', name: 'Søren Louv-Jansen' },
|
|
113
|
+
suggestedTargetBranches: [],
|
|
107
114
|
sourceCommit: {
|
|
115
|
+
branchLabelMapping: undefined,
|
|
108
116
|
committedDate: '2021-12-21T00:00:00Z',
|
|
109
117
|
sha: '3827bbbaf39914eda4f02f6940189844375fd097',
|
|
110
118
|
message: 'Add backport config',
|
|
111
119
|
},
|
|
112
|
-
|
|
120
|
+
pullRequestStates: [],
|
|
113
121
|
sourceBranch: 'source-branch-from-options',
|
|
114
122
|
},
|
|
115
123
|
{
|
|
116
124
|
author: { email: 'soren.louv@elastic.co', name: 'Søren Louv-Jansen' },
|
|
125
|
+
suggestedTargetBranches: [],
|
|
117
126
|
sourceCommit: {
|
|
127
|
+
branchLabelMapping: undefined,
|
|
118
128
|
committedDate: '2021-12-20T00:00:00Z',
|
|
119
129
|
sha: '5ea0da550ac191029459289d67f99ad7d310812b',
|
|
120
130
|
message: 'Initial commit',
|
|
121
131
|
},
|
|
122
|
-
|
|
132
|
+
pullRequestStates: [],
|
|
123
133
|
sourceBranch: 'source-branch-from-options',
|
|
124
134
|
},
|
|
125
135
|
];
|