backport 7.3.2-beta.1 → 7.3.3

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.
Files changed (44) hide show
  1. package/README.md +8 -0
  2. package/dist/backportRun.js +7 -0
  3. package/dist/entrypoint.cli.js +2 -2
  4. package/dist/entrypoint.module.d.ts +3 -0
  5. package/dist/entrypoint.module.js +19 -8
  6. package/dist/entrypoint.module.private.test.d.ts +1 -0
  7. package/dist/entrypoint.module.private.test.js +592 -0
  8. package/dist/options/ConfigOptions.d.ts +1 -0
  9. package/dist/options/cliArgs.d.ts +2 -0
  10. package/dist/options/cliArgs.js +8 -0
  11. package/dist/options/config/config.d.ts +1 -0
  12. package/dist/options/config/readConfigFile.d.ts +1 -0
  13. package/dist/options/options.d.ts +2 -0
  14. package/dist/options/options.js +5 -5
  15. package/dist/options/options.test.js +9 -2
  16. package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +2 -2
  17. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +3 -2
  18. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +4 -0
  19. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +1 -1
  20. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +1 -1
  21. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +3 -3
  22. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +10 -4
  23. package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.d.ts +12 -0
  24. package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +68 -0
  25. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +1 -0
  26. package/dist/services/prompt.test.js +1 -1
  27. package/dist/services/prompts.js +4 -4
  28. package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +1 -1
  29. package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +1 -1
  30. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +39 -39
  31. package/dist/services/sourceCommit/parseSourceCommit.test.js +3 -3
  32. package/dist/test/e2e/cli/cli.private.test.js +3 -0
  33. package/dist/test/handleUnbackportedPullRequests.private.test.js +1 -1
  34. package/dist/ui/getCommits.js +9 -3
  35. package/dist/ui/getCommitsWithoutBackports.test.js +2 -2
  36. package/dist/ui/getTargetBranches.js +1 -1
  37. package/dist/ui/getTargetBranches.test.js +2 -2
  38. package/dist/utils/filterMissingCommits.d.ts +2 -0
  39. package/dist/utils/filterMissingCommits.js +7 -0
  40. package/dist/utils/filterUnmergedCommits.d.ts +2 -0
  41. package/dist/utils/filterUnmergedCommits.js +7 -0
  42. package/dist/utils/packageVersion.d.ts +1 -1
  43. package/dist/utils/packageVersion.js +1 -1
  44. package/package.json +3 -2
package/README.md CHANGED
@@ -6,6 +6,14 @@
6
6
  <br>
7
7
  </div>
8
8
 
9
+ ## 🎉 New! The Backport Tool as a Github Action 🎉
10
+
11
+ A [Github Action](https://github.com/elastic/kibana-github-actions/tree/main/backport) around The Backport Tool now exists. It makes it a breeze to get automatic backports when pull requests are merged.
12
+
13
+ # Backport CLI tool
14
+
15
+ The remaining documentation focuses on the Backport CLI tool (not the Github Action) although all configuration options apply to the Github Action too. The only difference is that the CLI tool is interactive and run manually locally, where the Github Action runs automatically.
16
+
9
17
  ## How it works
10
18
 
11
19
  1. Select a commit to backport
@@ -36,6 +36,13 @@ async function backportRun(processArgs, optionsFromModule = {}) {
36
36
  spinner.stop();
37
37
  commits = await (0, getCommits_1.getCommits)(options);
38
38
  logger_1.logger.info('Commits', commits);
39
+ if (options.ls) {
40
+ return {
41
+ status: 'success',
42
+ commits,
43
+ results: [],
44
+ };
45
+ }
39
46
  const targetBranches = await (0, getTargetBranches_1.getTargetBranches)(options, commits);
40
47
  logger_1.logger.info('Target branches', targetBranches);
41
48
  const [gitConfigAuthor] = await Promise.all([
@@ -9,8 +9,8 @@ const processArgs = process.argv.slice(2);
9
9
  // this is the entrypoint when running from command line
10
10
  (0, backportRun_1.backportRun)(processArgs).then((backportResponse) => {
11
11
  const argv = (0, yargs_parser_1.default)(processArgs);
12
- const ci = argv.ci;
13
- if (ci) {
12
+ const { ci, ls } = argv;
13
+ if (ci || ls) {
14
14
  // eslint-disable-next-line no-console
15
15
  console.log(JSON.stringify(backportResponse));
16
16
  }
@@ -14,6 +14,9 @@ export declare function getCommits(options: {
14
14
  author?: string;
15
15
  branchLabelMapping?: ValidConfigOptions['branchLabelMapping'];
16
16
  githubApiBaseUrlV4?: string;
17
+ maxNumber?: number;
18
+ onlyMissing?: boolean;
19
+ prFilter?: string;
17
20
  pullNumber?: number;
18
21
  sha?: string | string[];
19
22
  skipRemoteConfig?: boolean;
@@ -5,6 +5,7 @@ const backportRun_1 = require("./backportRun");
5
5
  const fetchCommitByPullNumber_1 = require("./services/github/v4/fetchCommits/fetchCommitByPullNumber");
6
6
  const fetchCommitBySha_1 = require("./services/github/v4/fetchCommits/fetchCommitBySha");
7
7
  const fetchCommitsByAuthor_1 = require("./services/github/v4/fetchCommits/fetchCommitsByAuthor");
8
+ const fetchPullRequestsBySearchQuery_1 = require("./services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery");
8
9
  const getOptionsFromGithub_1 = require("./services/github/v4/getOptionsFromGithub/getOptionsFromGithub");
9
10
  const logger_1 = require("./services/logger");
10
11
  const excludeUndefined_1 = require("./utils/excludeUndefined");
@@ -40,13 +41,23 @@ async function getCommits(options) {
40
41
  const shas = Array.isArray(options.sha) ? options.sha : [options.sha];
41
42
  return Promise.all(shas.map((sha) => (0, fetchCommitBySha_1.fetchCommitBySha)({ ...optionsFromGithub, ...options, sha })));
42
43
  }
43
- return (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
44
- ...optionsFromGithub,
45
- ...options,
46
- // filters
47
- author: options.author ?? null,
48
- dateSince: options.dateSince ?? null,
49
- dateUntil: options.dateUntil ?? null,
50
- });
44
+ if (options.prFilter) {
45
+ return (0, fetchPullRequestsBySearchQuery_1.fetchPullRequestsBySearchQuery)({
46
+ ...optionsFromGithub,
47
+ ...options,
48
+ prFilter: options.prFilter,
49
+ author: options.author ?? null,
50
+ });
51
+ }
52
+ if (options.author) {
53
+ return (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
54
+ ...optionsFromGithub,
55
+ ...options,
56
+ author: options.author,
57
+ dateSince: options.dateSince ?? null,
58
+ dateUntil: options.dateUntil ?? null,
59
+ });
60
+ }
61
+ throw new Error('Must supply one of: `pullNumber`, `sha`, `prFilter` or `author`');
51
62
  }
52
63
  exports.getCommits = getCommits;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,592 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const entrypoint_module_1 = require("./entrypoint.module");
4
+ const getDevAccessToken_1 = require("./test/private/getDevAccessToken");
5
+ describe('entrypoint.module', () => {
6
+ describe('getCommits', () => {
7
+ it('pullNumber', async () => {
8
+ const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
9
+ const commits = await (0, entrypoint_module_1.getCommits)({
10
+ accessToken: accessToken,
11
+ repoName: 'kibana',
12
+ repoOwner: 'elastic',
13
+ pullNumber: 88188,
14
+ });
15
+ const expectedCommits = [
16
+ {
17
+ author: { name: 'Søren Louv-Jansen', email: 'sorenlouv@gmail.com' },
18
+ sourceCommit: {
19
+ committedDate: '2021-01-13T20:01:44Z',
20
+ message: '[APM] Fix incorrect table column header (95th instead of avg) (#88188)',
21
+ sha: 'd1b348e6213c5ad48653dfaad6eaf4928b2c688b',
22
+ },
23
+ sourcePullRequest: {
24
+ number: 88188,
25
+ url: 'https://github.com/elastic/kibana/pull/88188',
26
+ mergeCommit: {
27
+ message: '[APM] Fix incorrect table column header (95th instead of avg) (#88188)',
28
+ sha: 'd1b348e6213c5ad48653dfaad6eaf4928b2c688b',
29
+ },
30
+ },
31
+ sourceBranch: 'master',
32
+ expectedTargetPullRequests: [
33
+ {
34
+ url: 'https://github.com/elastic/kibana/pull/88288',
35
+ number: 88288,
36
+ branch: '7.x',
37
+ state: 'MERGED',
38
+ mergeCommit: {
39
+ sha: '52710be7add6811ec4783c7d383d4159c0aa76f5',
40
+ message: '[7.x] [APM] Fix incorrect table column header (95th instead of avg) (#88188) (#88288)\n\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>',
41
+ },
42
+ },
43
+ {
44
+ url: 'https://github.com/elastic/kibana/pull/88289',
45
+ number: 88289,
46
+ branch: '7.11',
47
+ state: 'MERGED',
48
+ mergeCommit: {
49
+ sha: 'b8194e9ec27d69f485d8b194d1cb5e4f6d8fef6d',
50
+ message: '[APM] Fix incorrect table column header (95th instead of avg) (#88188) (#88289)',
51
+ },
52
+ },
53
+ ],
54
+ },
55
+ ];
56
+ expect(commits).toEqual(expectedCommits);
57
+ });
58
+ it('sha', async () => {
59
+ const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
60
+ const commits = await (0, entrypoint_module_1.getCommits)({
61
+ accessToken: accessToken,
62
+ repoName: 'kibana',
63
+ repoOwner: 'elastic',
64
+ sha: 'd1b348e6213c5ad48653dfaad6eaf4928b2c688b',
65
+ });
66
+ const expectedCommits = [
67
+ {
68
+ author: { name: 'Søren Louv-Jansen', email: 'sorenlouv@gmail.com' },
69
+ sourceCommit: {
70
+ committedDate: '2021-01-13T20:01:44Z',
71
+ message: '[APM] Fix incorrect table column header (95th instead of avg) (#88188)',
72
+ sha: 'd1b348e6213c5ad48653dfaad6eaf4928b2c688b',
73
+ },
74
+ sourcePullRequest: {
75
+ number: 88188,
76
+ url: 'https://github.com/elastic/kibana/pull/88188',
77
+ mergeCommit: {
78
+ message: '[APM] Fix incorrect table column header (95th instead of avg) (#88188)',
79
+ sha: 'd1b348e6213c5ad48653dfaad6eaf4928b2c688b',
80
+ },
81
+ },
82
+ sourceBranch: 'master',
83
+ expectedTargetPullRequests: [
84
+ {
85
+ url: 'https://github.com/elastic/kibana/pull/88288',
86
+ number: 88288,
87
+ branch: '7.x',
88
+ state: 'MERGED',
89
+ mergeCommit: {
90
+ sha: '52710be7add6811ec4783c7d383d4159c0aa76f5',
91
+ message: '[7.x] [APM] Fix incorrect table column header (95th instead of avg) (#88188) (#88288)\n\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>',
92
+ },
93
+ },
94
+ {
95
+ url: 'https://github.com/elastic/kibana/pull/88289',
96
+ number: 88289,
97
+ branch: '7.11',
98
+ state: 'MERGED',
99
+ mergeCommit: {
100
+ sha: 'b8194e9ec27d69f485d8b194d1cb5e4f6d8fef6d',
101
+ message: '[APM] Fix incorrect table column header (95th instead of avg) (#88188) (#88289)',
102
+ },
103
+ },
104
+ ],
105
+ },
106
+ ];
107
+ expect(commits).toEqual(expectedCommits);
108
+ });
109
+ it('prFilter', async () => {
110
+ const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
111
+ const commits = await (0, entrypoint_module_1.getCommits)({
112
+ accessToken: accessToken,
113
+ repoName: 'kibana',
114
+ repoOwner: 'elastic',
115
+ prFilter: 'label:Team:apm merged:<2021-06-02 base:master',
116
+ maxNumber: 3,
117
+ });
118
+ expect(commits).toMatchInlineSnapshot(`
119
+ Array [
120
+ Object {
121
+ "author": Object {
122
+ "email": "pierre.gayvallet@elastic.co",
123
+ "name": "Pierre Gayvallet",
124
+ },
125
+ "expectedTargetPullRequests": Array [
126
+ Object {
127
+ "branch": "7.x",
128
+ "mergeCommit": Object {
129
+ "message": "[7.x] Migrate most plugins to synchronous lifecycle (#89562) (#90579)
130
+
131
+ * Migrate most plugins to synchronous lifecycle (#89562)
132
+
133
+ * first pass
134
+
135
+ * migrate more plugins
136
+
137
+ * migrate yet more plugins
138
+
139
+ * more oss plugins
140
+
141
+ * fix test file
142
+
143
+ * change Plugin signature on the client-side too
144
+
145
+ * fix test types
146
+
147
+ * migrate OSS client-side plugins
148
+
149
+ * migrate OSS client-side test plugins
150
+
151
+ * migrate xpack client-side plugins
152
+
153
+ * revert fix attempt on fleet plugin
154
+
155
+ * fix presentation start signature
156
+
157
+ * fix yet another signature
158
+
159
+ * add warnings for server-side async plugins in dev mode
160
+
161
+ * remove unused import
162
+
163
+ * fix isPromise
164
+
165
+ * Add client-side deprecations
166
+
167
+ * update migration examples
168
+
169
+ * update generated doc
170
+
171
+ * fix xpack unit tests
172
+
173
+ * nit
174
+
175
+ * (will be reverted) explicitly await for license to be ready in the auth hook
176
+
177
+ * Revert \\"(will be reverted) explicitly await for license to be ready in the auth hook\\"
178
+
179
+ This reverts commit fdf73feb
180
+
181
+ * restore await on on promise contracts
182
+
183
+ * Revert \\"(will be reverted) explicitly await for license to be ready in the auth hook\\"
184
+
185
+ This reverts commit fdf73feb
186
+
187
+ * Revert \\"restore await on on promise contracts\\"
188
+
189
+ This reverts commit c5f2fe51
190
+
191
+ * add delay before starting tests in FTR
192
+
193
+ * update deprecation ts doc
194
+
195
+ * add explicit contract for monitoring setup
196
+
197
+ * migrate monitoring plugin to sync
198
+
199
+ * change plugin timeout to 10sec
200
+
201
+ * use delay instead of silence
202
+ # Conflicts:
203
+ # x-pack/plugins/xpack_legacy/server/plugin.ts
204
+
205
+ * fix mock",
206
+ "sha": "97f89e256b14dd01a4f20355dd04e8e27241c90a",
207
+ },
208
+ "number": 90579,
209
+ "state": "MERGED",
210
+ "url": "https://github.com/elastic/kibana/pull/90579",
211
+ },
212
+ ],
213
+ "sourceBranch": "master",
214
+ "sourceCommit": Object {
215
+ "committedDate": "2021-02-08T09:19:54Z",
216
+ "message": "Migrate most plugins to synchronous lifecycle (#89562)
217
+
218
+ * first pass
219
+
220
+ * migrate more plugins
221
+
222
+ * migrate yet more plugins
223
+
224
+ * more oss plugins
225
+
226
+ * fix test file
227
+
228
+ * change Plugin signature on the client-side too
229
+
230
+ * fix test types
231
+
232
+ * migrate OSS client-side plugins
233
+
234
+ * migrate OSS client-side test plugins
235
+
236
+ * migrate xpack client-side plugins
237
+
238
+ * revert fix attempt on fleet plugin
239
+
240
+ * fix presentation start signature
241
+
242
+ * fix yet another signature
243
+
244
+ * add warnings for server-side async plugins in dev mode
245
+
246
+ * remove unused import
247
+
248
+ * fix isPromise
249
+
250
+ * Add client-side deprecations
251
+
252
+ * update migration examples
253
+
254
+ * update generated doc
255
+
256
+ * fix xpack unit tests
257
+
258
+ * nit
259
+
260
+ * (will be reverted) explicitly await for license to be ready in the auth hook
261
+
262
+ * Revert \\"(will be reverted) explicitly await for license to be ready in the auth hook\\"
263
+
264
+ This reverts commit fdf73feb
265
+
266
+ * restore await on on promise contracts
267
+
268
+ * Revert \\"(will be reverted) explicitly await for license to be ready in the auth hook\\"
269
+
270
+ This reverts commit fdf73feb
271
+
272
+ * Revert \\"restore await on on promise contracts\\"
273
+
274
+ This reverts commit c5f2fe51
275
+
276
+ * add delay before starting tests in FTR
277
+
278
+ * update deprecation ts doc
279
+
280
+ * add explicit contract for monitoring setup
281
+
282
+ * migrate monitoring plugin to sync
283
+
284
+ * change plugin timeout to 10sec
285
+
286
+ * use delay instead of silence",
287
+ "sha": "3b3327dbc3c3041c9681e0cd86bd31cf411dc460",
288
+ },
289
+ "sourcePullRequest": Object {
290
+ "mergeCommit": Object {
291
+ "message": "Migrate most plugins to synchronous lifecycle (#89562)
292
+
293
+ * first pass
294
+
295
+ * migrate more plugins
296
+
297
+ * migrate yet more plugins
298
+
299
+ * more oss plugins
300
+
301
+ * fix test file
302
+
303
+ * change Plugin signature on the client-side too
304
+
305
+ * fix test types
306
+
307
+ * migrate OSS client-side plugins
308
+
309
+ * migrate OSS client-side test plugins
310
+
311
+ * migrate xpack client-side plugins
312
+
313
+ * revert fix attempt on fleet plugin
314
+
315
+ * fix presentation start signature
316
+
317
+ * fix yet another signature
318
+
319
+ * add warnings for server-side async plugins in dev mode
320
+
321
+ * remove unused import
322
+
323
+ * fix isPromise
324
+
325
+ * Add client-side deprecations
326
+
327
+ * update migration examples
328
+
329
+ * update generated doc
330
+
331
+ * fix xpack unit tests
332
+
333
+ * nit
334
+
335
+ * (will be reverted) explicitly await for license to be ready in the auth hook
336
+
337
+ * Revert \\"(will be reverted) explicitly await for license to be ready in the auth hook\\"
338
+
339
+ This reverts commit fdf73feb
340
+
341
+ * restore await on on promise contracts
342
+
343
+ * Revert \\"(will be reverted) explicitly await for license to be ready in the auth hook\\"
344
+
345
+ This reverts commit fdf73feb
346
+
347
+ * Revert \\"restore await on on promise contracts\\"
348
+
349
+ This reverts commit c5f2fe51
350
+
351
+ * add delay before starting tests in FTR
352
+
353
+ * update deprecation ts doc
354
+
355
+ * add explicit contract for monitoring setup
356
+
357
+ * migrate monitoring plugin to sync
358
+
359
+ * change plugin timeout to 10sec
360
+
361
+ * use delay instead of silence",
362
+ "sha": "3b3327dbc3c3041c9681e0cd86bd31cf411dc460",
363
+ },
364
+ "number": 89562,
365
+ "url": "https://github.com/elastic/kibana/pull/89562",
366
+ },
367
+ },
368
+ Object {
369
+ "author": Object {
370
+ "email": "w@tson.dk",
371
+ "name": "Thomas Watson",
372
+ },
373
+ "expectedTargetPullRequests": Array [
374
+ Object {
375
+ "branch": "7.x",
376
+ "mergeCommit": Object {
377
+ "message": "Upgrade to hapi version 20 (#85406) (#86592)",
378
+ "sha": "777c80d8a0f72be16091510d0cb5d09693ba6bb4",
379
+ },
380
+ "number": 86592,
381
+ "state": "MERGED",
382
+ "url": "https://github.com/elastic/kibana/pull/86592",
383
+ },
384
+ ],
385
+ "sourceBranch": "master",
386
+ "sourceCommit": Object {
387
+ "committedDate": "2020-12-19T12:10:11Z",
388
+ "message": "Upgrade to hapi version 20 (#85406)",
389
+ "sha": "e8b21bc6c12cfd793c46e1d86577d5e5ec8a71f8",
390
+ },
391
+ "sourcePullRequest": Object {
392
+ "mergeCommit": Object {
393
+ "message": "Upgrade to hapi version 20 (#85406)",
394
+ "sha": "e8b21bc6c12cfd793c46e1d86577d5e5ec8a71f8",
395
+ },
396
+ "number": 85406,
397
+ "url": "https://github.com/elastic/kibana/pull/85406",
398
+ },
399
+ },
400
+ Object {
401
+ "author": Object {
402
+ "email": "nathan.smith@elastic.co",
403
+ "name": "Nathan L Smith",
404
+ },
405
+ "expectedTargetPullRequests": Array [
406
+ Object {
407
+ "branch": "7.x",
408
+ "mergeCommit": Object {
409
+ "message": "Move EUI styled components integration to kibana_react (#86065) (#89217)
410
+
411
+ ...from xpack_legacy.
412
+
413
+ Remove the duplicated typings from the observability plugin and only use the ones from kibana_react.
414
+
415
+ Fixes #78248.",
416
+ "sha": "57b798474ae5ec2892a06ffa5706c5dd405db137",
417
+ },
418
+ "number": 89217,
419
+ "state": "MERGED",
420
+ "url": "https://github.com/elastic/kibana/pull/89217",
421
+ },
422
+ ],
423
+ "sourceBranch": "master",
424
+ "sourceCommit": Object {
425
+ "committedDate": "2021-01-25T19:48:35Z",
426
+ "message": "Move EUI styled components integration to kibana_react (#86065)
427
+
428
+ ...from xpack_legacy.
429
+
430
+ Remove the duplicated typings from the observability plugin and only use the ones from kibana_react.
431
+
432
+ Fixes #78248.",
433
+ "sha": "e5588a129b1a0b2796822d4773176cc712dd5318",
434
+ },
435
+ "sourcePullRequest": Object {
436
+ "mergeCommit": Object {
437
+ "message": "Move EUI styled components integration to kibana_react (#86065)
438
+
439
+ ...from xpack_legacy.
440
+
441
+ Remove the duplicated typings from the observability plugin and only use the ones from kibana_react.
442
+
443
+ Fixes #78248.",
444
+ "sha": "e5588a129b1a0b2796822d4773176cc712dd5318",
445
+ },
446
+ "number": 86065,
447
+ "url": "https://github.com/elastic/kibana/pull/86065",
448
+ },
449
+ },
450
+ ]
451
+ `);
452
+ });
453
+ it('author', async () => {
454
+ const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
455
+ const commits = await (0, entrypoint_module_1.getCommits)({
456
+ accessToken: accessToken,
457
+ repoName: 'kibana',
458
+ repoOwner: 'elastic',
459
+ author: 'sqren',
460
+ dateUntil: '2021-01-01T10:00:00Z',
461
+ maxNumber: 3,
462
+ });
463
+ expect(commits).toMatchInlineSnapshot(`
464
+ Array [
465
+ Object {
466
+ "author": Object {
467
+ "email": "sorenlouv@gmail.com",
468
+ "name": "Søren Louv-Jansen",
469
+ },
470
+ "expectedTargetPullRequests": Array [
471
+ Object {
472
+ "branch": "7.x",
473
+ "mergeCommit": Object {
474
+ "message": "[APM] Fix broken link to ML when time range is not set (#85976) (#86227)
475
+
476
+ Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>",
477
+ "sha": "2d361f018e0776c237d03b84ca8aa24615d16d99",
478
+ },
479
+ "number": 86227,
480
+ "state": "MERGED",
481
+ "url": "https://github.com/elastic/kibana/pull/86227",
482
+ },
483
+ Object {
484
+ "branch": "7.11",
485
+ "mergeCommit": Object {
486
+ "message": "[APM] Fix broken link to ML when time range is not set (#85976) (#86228)",
487
+ "sha": "c6c0015e01601cd852730d5cd20e1a906cbee900",
488
+ },
489
+ "number": 86228,
490
+ "state": "MERGED",
491
+ "url": "https://github.com/elastic/kibana/pull/86228",
492
+ },
493
+ ],
494
+ "sourceBranch": "master",
495
+ "sourceCommit": Object {
496
+ "committedDate": "2020-12-16T15:17:03Z",
497
+ "message": "[APM] Fix broken link to ML when time range is not set (#85976)",
498
+ "sha": "744d6809ded7e1055bfda280c351cee3e8c0e3bf",
499
+ },
500
+ "sourcePullRequest": Object {
501
+ "mergeCommit": Object {
502
+ "message": "[APM] Fix broken link to ML when time range is not set (#85976)",
503
+ "sha": "744d6809ded7e1055bfda280c351cee3e8c0e3bf",
504
+ },
505
+ "number": 85976,
506
+ "url": "https://github.com/elastic/kibana/pull/85976",
507
+ },
508
+ },
509
+ Object {
510
+ "author": Object {
511
+ "email": "sorenlouv@gmail.com",
512
+ "name": "Søren Louv-Jansen",
513
+ },
514
+ "expectedTargetPullRequests": Array [
515
+ Object {
516
+ "branch": "7.x",
517
+ "mergeCommit": Object {
518
+ "message": "[7.x] [APM] Correlations polish (#85116) (#85940)
519
+
520
+ Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>",
521
+ "sha": "42b3ecb40c344cd57800b8fa387ae32bad24bfc4",
522
+ },
523
+ "number": 85940,
524
+ "state": "MERGED",
525
+ "url": "https://github.com/elastic/kibana/pull/85940",
526
+ },
527
+ ],
528
+ "sourceBranch": "master",
529
+ "sourceCommit": Object {
530
+ "committedDate": "2020-12-15T12:15:00Z",
531
+ "message": "[APM] Correlations polish (#85116)
532
+
533
+ Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>",
534
+ "sha": "20638a64e2a895d4e4a6597d4a37b5db7003f1e9",
535
+ },
536
+ "sourcePullRequest": Object {
537
+ "mergeCommit": Object {
538
+ "message": "[APM] Correlations polish (#85116)
539
+
540
+ Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>",
541
+ "sha": "20638a64e2a895d4e4a6597d4a37b5db7003f1e9",
542
+ },
543
+ "number": 85116,
544
+ "url": "https://github.com/elastic/kibana/pull/85116",
545
+ },
546
+ },
547
+ Object {
548
+ "author": Object {
549
+ "email": "sorenlouv@gmail.com",
550
+ "name": "Søren Louv-Jansen",
551
+ },
552
+ "expectedTargetPullRequests": Array [
553
+ Object {
554
+ "branch": "7.x",
555
+ "mergeCommit": Object {
556
+ "message": "[7.x] [APM] Improve pointer event hook (#85117) (#85142)",
557
+ "sha": "3b72a4f3cc7c0abd0541073e1d0246b85cea3def",
558
+ },
559
+ "number": 85142,
560
+ "state": "MERGED",
561
+ "url": "https://github.com/elastic/kibana/pull/85142",
562
+ },
563
+ ],
564
+ "sourceBranch": "master",
565
+ "sourceCommit": Object {
566
+ "committedDate": "2020-12-07T14:43:58Z",
567
+ "message": "[APM] Improve pointer event hook (#85117)",
568
+ "sha": "cee681afb3c5f87371112fab9a7e5dddbafea0a8",
569
+ },
570
+ "sourcePullRequest": Object {
571
+ "mergeCommit": Object {
572
+ "message": "[APM] Improve pointer event hook (#85117)",
573
+ "sha": "cee681afb3c5f87371112fab9a7e5dddbafea0a8",
574
+ },
575
+ "number": 85117,
576
+ "url": "https://github.com/elastic/kibana/pull/85117",
577
+ },
578
+ },
579
+ ]
580
+ `);
581
+ });
582
+ it('throws when missing a filter', async () => {
583
+ const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
584
+ await expect(() => (0, entrypoint_module_1.getCommits)({
585
+ accessToken: accessToken,
586
+ repoName: 'kibana',
587
+ repoOwner: 'elastic',
588
+ maxNumber: 3,
589
+ })).rejects.toThrowError('Must supply one of: `pullNumber`, `sha`, `prFilter` or `author`');
590
+ });
591
+ });
592
+ });