backport 8.3.0 → 8.3.1
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/backportRun.js +1 -1
- package/dist/entrypoint.module.d.ts +2 -2
- package/dist/entrypoint.module.js +2 -0
- package/dist/entrypoint.module.private.test.js +11 -10
- package/dist/lib/getCommits.js +1 -1
- package/dist/lib/git.js +2 -1
- package/dist/lib/github/v3/createStatusComment.js +3 -2
- package/dist/lib/github/v3/createStatusComment.test.js +61 -0
- package/dist/lib/github/v4/apiRequestV4.js +1 -1
- package/dist/lib/github/v4/enablePullRequestAutoMerge.js +2 -1
- package/dist/lib/github/v4/enablePullRequestAutoMerge.mutation.test.d.ts +1 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.mutation.test.js +138 -0
- package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.js +5 -3
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.js +0 -1
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.js +0 -1
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.js +5 -6
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +7 -3
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.d.ts +2 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +23 -7
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +1 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +1 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +2 -0
- package/dist/lib/github/v4/getOptionsFromGithub/query.d.ts +1 -0
- package/dist/lib/github/v4/getOptionsFromGithub/query.js +1 -0
- package/dist/lib/remoteConfig.d.ts +1 -1
- package/dist/lib/remoteConfig.js +4 -0
- package/dist/options/cliArgs.d.ts +2 -2
- package/dist/options/cliArgs.js +16 -6
- package/dist/options/options.d.ts +3 -2
- package/dist/options/options.js +0 -1
- package/dist/options/options.test.js +2 -0
- package/dist/test/e2e/cli/date-filters.d.ts +1 -0
- package/dist/test/e2e/cli/date-filters.js +43 -0
- package/dist/test/e2e/cli/date-filters.private.test.d.ts +1 -0
- package/dist/test/e2e/cli/date-filters.private.test.js +47 -0
- package/dist/test/e2e/cli/entrypoint.cli.private.test.js +2 -18
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +13 -13
- package/yarn.lock +165 -171
package/dist/options/cliArgs.js
CHANGED
|
@@ -76,13 +76,25 @@ function getOptionsFromCliArgs(processArgs) {
|
|
|
76
76
|
description: 'Path to global config',
|
|
77
77
|
type: 'string',
|
|
78
78
|
})
|
|
79
|
-
.option('
|
|
79
|
+
.option('dateSince', {
|
|
80
|
+
alias: 'since',
|
|
80
81
|
description: 'ISO-8601 date for filtering commits',
|
|
81
82
|
type: 'string',
|
|
83
|
+
coerce: (since) => {
|
|
84
|
+
if (since) {
|
|
85
|
+
return new Date(since).toISOString();
|
|
86
|
+
}
|
|
87
|
+
},
|
|
82
88
|
})
|
|
83
|
-
.option('
|
|
89
|
+
.option('dateUntil', {
|
|
90
|
+
alias: 'until',
|
|
84
91
|
description: 'ISO-8601 date for filtering commits',
|
|
85
92
|
type: 'string',
|
|
93
|
+
coerce: (until) => {
|
|
94
|
+
if (until) {
|
|
95
|
+
return new Date(until).toISOString();
|
|
96
|
+
}
|
|
97
|
+
},
|
|
86
98
|
})
|
|
87
99
|
.option('dir', {
|
|
88
100
|
description: 'Path to temporary backport repo',
|
|
@@ -230,7 +242,7 @@ function getOptionsFromCliArgs(processArgs) {
|
|
|
230
242
|
type: 'string',
|
|
231
243
|
})
|
|
232
244
|
.option('prFilter', {
|
|
233
|
-
conflicts: ['pullNumber', 'sha'],
|
|
245
|
+
conflicts: ['pullNumber', 'sha', 'path'],
|
|
234
246
|
description: `Filter source pull requests by a query`,
|
|
235
247
|
type: 'string',
|
|
236
248
|
})
|
|
@@ -329,7 +341,7 @@ function getOptionsFromCliArgs(processArgs) {
|
|
|
329
341
|
// shorthands
|
|
330
342
|
repo,
|
|
331
343
|
// filters
|
|
332
|
-
author,
|
|
344
|
+
author,
|
|
333
345
|
// negations
|
|
334
346
|
noCherrypickRef, noFork, noStatusComment, noVerify, verify, nonInteractive,
|
|
335
347
|
// array types (should be renamed to plural form)
|
|
@@ -345,8 +357,6 @@ function getOptionsFromCliArgs(processArgs) {
|
|
|
345
357
|
repoName,
|
|
346
358
|
// filters
|
|
347
359
|
author: all ? null : author,
|
|
348
|
-
dateSince: since ? new Date(since).toISOString() : undefined,
|
|
349
|
-
dateUntil: until ? new Date(until).toISOString() : undefined,
|
|
350
360
|
// `multiple` is a cli-only flag to override `multipleBranches` and `multipleCommits`
|
|
351
361
|
multipleBranches: multiple ?? multipleBranches,
|
|
352
362
|
multipleCommits: multiple ?? multipleCommits,
|
|
@@ -50,6 +50,8 @@ export declare function getOptions({ optionsFromCliArgs, optionsFromModule, }: {
|
|
|
50
50
|
cherrypickRef: boolean;
|
|
51
51
|
projectConfigFile?: string | undefined;
|
|
52
52
|
globalConfigFile?: string | undefined;
|
|
53
|
+
dateSince: string | null;
|
|
54
|
+
dateUntil: string | null;
|
|
53
55
|
details: boolean;
|
|
54
56
|
dryRun?: boolean | undefined;
|
|
55
57
|
editor?: string | undefined;
|
|
@@ -74,8 +76,6 @@ export declare function getOptions({ optionsFromCliArgs, optionsFromModule, }: {
|
|
|
74
76
|
sha?: string | string[] | undefined;
|
|
75
77
|
resetAuthor: boolean;
|
|
76
78
|
sourceBranch: string;
|
|
77
|
-
dateSince: string | null;
|
|
78
|
-
dateUntil: string | null;
|
|
79
79
|
commitPaths: string[];
|
|
80
80
|
reviewers: string[];
|
|
81
81
|
sourcePRLabels: string[];
|
|
@@ -101,4 +101,5 @@ export declare function getOptions({ optionsFromCliArgs, optionsFromModule, }: {
|
|
|
101
101
|
branches?: TargetBranchChoiceOrString[] | undefined;
|
|
102
102
|
labels?: string[] | undefined;
|
|
103
103
|
authenticatedUsername: string;
|
|
104
|
+
isRepoPrivate: boolean;
|
|
104
105
|
}>;
|
package/dist/options/options.js
CHANGED
|
@@ -199,6 +199,7 @@ describe('getOptions', () => {
|
|
|
199
199
|
gitHostname: 'github.com',
|
|
200
200
|
githubApiBaseUrlV4: 'http://localhost/graphql',
|
|
201
201
|
interactive: true,
|
|
202
|
+
isRepoPrivate: false,
|
|
202
203
|
maxNumber: 10,
|
|
203
204
|
multipleBranches: true,
|
|
204
205
|
multipleCommits: false,
|
|
@@ -397,6 +398,7 @@ function mockGithubConfigOptions({ viewerLogin = 'DO_NOT_USE-sqren', defaultBran
|
|
|
397
398
|
login: viewerLogin,
|
|
398
399
|
},
|
|
399
400
|
repository: {
|
|
401
|
+
isPrivate: false,
|
|
400
402
|
illegalBackportBranch: hasBackportBranch ? { id: 'foo' } : null,
|
|
401
403
|
defaultBranchRef: {
|
|
402
404
|
name: defaultBranchRef,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
describe('date filters (dateSince, dateUntil)', () => {
|
|
7
|
+
it(`filters commits by "since" and "until"`, async () => {
|
|
8
|
+
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
9
|
+
'--branch=7.x',
|
|
10
|
+
'--repo=backport-org/backport-e2e',
|
|
11
|
+
`--accessToken=${accessToken}`,
|
|
12
|
+
'--since=2020-08-15T10:00:00.000Z',
|
|
13
|
+
'--until=2020-08-15T10:30:00.000Z',
|
|
14
|
+
], { waitForString: 'Select commit' });
|
|
15
|
+
expect(output).toMatchInlineSnapshot(`
|
|
16
|
+
"? Select commit (Use arrow keys)
|
|
17
|
+
❯ 1. Bump to 8.0.0
|
|
18
|
+
2. Add package.json
|
|
19
|
+
3. Update .backportrc.json
|
|
20
|
+
4. Create .backportrc.json"
|
|
21
|
+
`);
|
|
22
|
+
});
|
|
23
|
+
it('works with --pr-filter', async () => {
|
|
24
|
+
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
25
|
+
'--branch=7.x',
|
|
26
|
+
'--repo=elastic/kibana',
|
|
27
|
+
`--accessToken=${accessToken}`,
|
|
28
|
+
`--author=sqren`,
|
|
29
|
+
'--since=2021-09-20',
|
|
30
|
+
'--until=2021-10-01',
|
|
31
|
+
]);
|
|
32
|
+
const { output: output2 } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
33
|
+
'--branch=7.x',
|
|
34
|
+
'--repo=elastic/kibana',
|
|
35
|
+
`--accessToken=${accessToken}`,
|
|
36
|
+
`--pr-filter="author:sqren"`,
|
|
37
|
+
'--since=2021-09-20',
|
|
38
|
+
'--until=2021-10-01',
|
|
39
|
+
]);
|
|
40
|
+
expect(output).toMatchInlineSnapshot();
|
|
41
|
+
expect(output2).toMatchInlineSnapshot();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
describe('date filters (dateSince, dateUntil)', () => {
|
|
7
|
+
it(`filters commits by "since" and "until"`, async () => {
|
|
8
|
+
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
9
|
+
'--branch=7.x',
|
|
10
|
+
'--repo=backport-org/backport-e2e',
|
|
11
|
+
`--accessToken=${accessToken}`,
|
|
12
|
+
'--since=2020-08-15T10:00:00.000Z',
|
|
13
|
+
'--until=2020-08-15T10:30:00.000Z',
|
|
14
|
+
], { waitForString: 'Select commit' });
|
|
15
|
+
expect(output).toMatchInlineSnapshot(`
|
|
16
|
+
"? Select commit (Use arrow keys)
|
|
17
|
+
❯ 1. Bump to 8.0.0
|
|
18
|
+
2. Add package.json
|
|
19
|
+
3. Update .backportrc.json
|
|
20
|
+
4. Create .backportrc.json"
|
|
21
|
+
`);
|
|
22
|
+
});
|
|
23
|
+
it('combined with --pr-filter', async () => {
|
|
24
|
+
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
25
|
+
'--branch=7.x',
|
|
26
|
+
'--repo=elastic/kibana',
|
|
27
|
+
`--accessToken=${accessToken}`,
|
|
28
|
+
`--author=sqren`,
|
|
29
|
+
'--since=2021-09-20',
|
|
30
|
+
'--until=2021-10-01',
|
|
31
|
+
], { waitForString: 'Select commit' });
|
|
32
|
+
const { output: outputFromPrFilter } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
33
|
+
'--branch=7.x',
|
|
34
|
+
'--repo=elastic/kibana',
|
|
35
|
+
`--accessToken=${accessToken}`,
|
|
36
|
+
`--pr-filter="author:sqren"`,
|
|
37
|
+
'--since=2021-09-20',
|
|
38
|
+
'--until=2021-10-01',
|
|
39
|
+
'--source-branch=master',
|
|
40
|
+
], { waitForString: 'Select commit' });
|
|
41
|
+
expect(output).toMatchInlineSnapshot(`
|
|
42
|
+
"? Select commit (Use arrow keys)
|
|
43
|
+
❯ 1. [APM] Add link to officials docs for APM UI settings (#113396) 7.x"
|
|
44
|
+
`);
|
|
45
|
+
expect(output).toEqual(outputFromPrFilter);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -65,8 +65,8 @@ describe('entrypoint cli', () => {
|
|
|
65
65
|
[boolean]
|
|
66
66
|
--projectConfigFile, --config Path to project config [string]
|
|
67
67
|
--globalConfigFile Path to global config [string]
|
|
68
|
-
--since
|
|
69
|
-
--until
|
|
68
|
+
--dateSince, --since ISO-8601 date for filtering commits [string]
|
|
69
|
+
--dateUntil, --until ISO-8601 date for filtering commits [string]
|
|
70
70
|
--dir Path to temporary backport repo [string]
|
|
71
71
|
--details Show details about each commit [boolean]
|
|
72
72
|
--dryRun Run backport locally without pushing to Github [boolean]
|
|
@@ -159,22 +159,6 @@ describe('entrypoint cli', () => {
|
|
|
159
159
|
6. Merge pull request #1 from backport-org/add-heart-emoji"
|
|
160
160
|
`);
|
|
161
161
|
});
|
|
162
|
-
it(`filters commits by "since" and "until"`, async () => {
|
|
163
|
-
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
164
|
-
'--branch=7.x',
|
|
165
|
-
'--repo=backport-org/backport-e2e',
|
|
166
|
-
`--accessToken=${accessToken}`,
|
|
167
|
-
'--since=2020-08-15T10:00:00.000Z',
|
|
168
|
-
'--until=2020-08-15T10:30:00.000Z',
|
|
169
|
-
], { waitForString: 'Select commit' });
|
|
170
|
-
expect(output).toMatchInlineSnapshot(`
|
|
171
|
-
"? Select commit (Use arrow keys)
|
|
172
|
-
❯ 1. Bump to 8.0.0
|
|
173
|
-
2. Add package.json
|
|
174
|
-
3. Update .backportrc.json
|
|
175
|
-
4. Create .backportrc.json"
|
|
176
|
-
`);
|
|
177
|
-
});
|
|
178
162
|
it(`lists commits from 7.x`, async () => {
|
|
179
163
|
const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
|
|
180
164
|
'--branch=7.x',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "8.3.
|
|
1
|
+
export declare const PACKAGE_VERSION = "8.3.1";
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"branches",
|
|
15
15
|
"branching"
|
|
16
16
|
],
|
|
17
|
-
"version": "8.3.
|
|
17
|
+
"version": "8.3.1",
|
|
18
18
|
"main": "./dist/entrypoint.module.js",
|
|
19
19
|
"types": "dist/entrypoint.module.d.ts",
|
|
20
20
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"test-mutation": "jest --config ./jest.config.mutation.js",
|
|
35
35
|
"test-private": "jest --config ./jest.config.private.js",
|
|
36
36
|
"test": "jest",
|
|
37
|
-
"docker-run": "./docker/
|
|
37
|
+
"docker-run": "./docker/build-and-run-dockerfile.sh"
|
|
38
38
|
},
|
|
39
39
|
"lint-staged": {
|
|
40
40
|
"*.ts": [
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"find-up": "^5.0.0",
|
|
73
73
|
"graphql": "^16.3.0",
|
|
74
74
|
"graphql-tag": "^2.12.6",
|
|
75
|
-
"inquirer": "^8.2.
|
|
75
|
+
"inquirer": "^8.2.2",
|
|
76
76
|
"lodash": "^4.17.21",
|
|
77
77
|
"make-dir": "^3.1.0",
|
|
78
78
|
"ora": "^5.4.1",
|
|
@@ -87,30 +87,30 @@
|
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@types/core-js": "^2.5.5",
|
|
89
89
|
"@types/dedent": "^0.7.0",
|
|
90
|
-
"@types/inquirer": "^8.2.
|
|
90
|
+
"@types/inquirer": "^8.2.1",
|
|
91
91
|
"@types/jest": "^27.4.1",
|
|
92
|
-
"@types/lodash": "^4.14.
|
|
92
|
+
"@types/lodash": "^4.14.181",
|
|
93
93
|
"@types/node": "^17.0.23",
|
|
94
94
|
"@types/safe-json-stringify": "^1.1.2",
|
|
95
95
|
"@types/yargs": "^17.0.10",
|
|
96
96
|
"@types/yargs-parser": "^21.0.0",
|
|
97
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
98
|
-
"@typescript-eslint/parser": "^5.
|
|
99
|
-
"eslint": "^8.
|
|
97
|
+
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
|
98
|
+
"@typescript-eslint/parser": "^5.17.0",
|
|
99
|
+
"eslint": "^8.12.0",
|
|
100
100
|
"eslint-config-prettier": "^8.5.0",
|
|
101
101
|
"eslint-plugin-import": "^2.25.4",
|
|
102
|
-
"eslint-plugin-jest": "^26.1.
|
|
102
|
+
"eslint-plugin-jest": "^26.1.3",
|
|
103
103
|
"eslint-plugin-prettier": "^4.0.0",
|
|
104
|
-
"graphql-config": "^4.
|
|
104
|
+
"graphql-config": "^4.2.0",
|
|
105
105
|
"husky": "^7.0.4",
|
|
106
106
|
"jest": "^27.5.1",
|
|
107
107
|
"jest-snapshot-serializer-ansi": "^1.0.0",
|
|
108
108
|
"lint-staged": "^12.3.7",
|
|
109
109
|
"nock": "^13.2.4",
|
|
110
|
-
"prettier": "^2.6.
|
|
110
|
+
"prettier": "^2.6.2",
|
|
111
111
|
"strip-ansi": "^6.0.1",
|
|
112
|
-
"ts-jest": "^27.1.
|
|
112
|
+
"ts-jest": "^27.1.4",
|
|
113
113
|
"ts-node": "^10.7.0",
|
|
114
|
-
"typescript": "^4.6.
|
|
114
|
+
"typescript": "^4.6.3"
|
|
115
115
|
}
|
|
116
116
|
}
|