backport 6.3.0-beta-10 → 7.0.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/README.md +2 -1
- package/dist/backportRun.js +1 -1
- package/dist/entrypoint.cli.e2e.private.test.js +58 -19
- package/dist/entrypoint.cli.private.test.js +1 -1
- package/dist/options/ConfigOptions.d.ts +1 -0
- package/dist/options/cliArgs.js +1 -1
- package/dist/options/cliArgs.test.js +12 -0
- package/dist/options/config/config.d.ts +1 -0
- package/dist/options/config/projectConfig.js +2 -2
- package/dist/options/config/readConfigFile.d.ts +1 -0
- package/dist/options/options.d.ts +1 -0
- package/dist/options/options.js +2 -0
- package/dist/runSequentially.test.js +1 -1
- package/dist/services/github/v3/createPullRequest.test.js +5 -5
- package/dist/services/github/v3/createStatusComment.test.js +7 -7
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +1 -1
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +1 -0
- package/dist/services/sourceCommit/getMockSourceCommit.js +1 -7
- package/dist/test/backport-e2e.mutation.test.js +4 -4
- package/dist/test/handleUnbackportedPullRequests.private.test.js +2 -2
- package/dist/test/setupFiles/automatic-mocks.js +5 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +3 -3
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +7 -7
- package/yarn.lock +488 -397
- package/dist/utils/packageVersion.ts +0 -1
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ Add a [project config](https://github.com/sqren/backport/blob/master/docs/config
|
|
|
41
41
|
"targetBranchChoices": ["main", "6.3", "6.2", "6.1", "6.0"],
|
|
42
42
|
|
|
43
43
|
// Optional: Automatically detect which branches a pull request should be backported to based on the pull request labels.
|
|
44
|
+
// In this case, adding the label "backport-to-production" will backport the PR to the "production" branch
|
|
44
45
|
"branchLabelMapping": {
|
|
45
46
|
"^backport-to-(.+)$": "$1"
|
|
46
47
|
}
|
|
@@ -111,7 +112,7 @@ The CLI options will override the [configuration options](https://github.com/sqr
|
|
|
111
112
|
|
|
112
113
|
## Backport Module API
|
|
113
114
|
|
|
114
|
-
`backport` can be imported as a Node module and interacted with programatically. This can be useful when creating automation around the Backport tool. See for example the [Backport Github Action](https://github.com/
|
|
115
|
+
`backport` can be imported as a Node module and interacted with programatically. This can be useful when creating automation around the Backport tool. See for example the [Backport Github Action](https://github.com/sqren/backport-github-action)
|
|
115
116
|
|
|
116
117
|
### `backportRun`
|
|
117
118
|
|
package/dist/backportRun.js
CHANGED
|
@@ -23,7 +23,7 @@ async function backportRun(processArgs, optionsFromModule = {}) {
|
|
|
23
23
|
(0, logger_1.initLogger)({ ci, logFilePath });
|
|
24
24
|
// don't show spinner for yargs commands that exit the process without stopping the spinner first
|
|
25
25
|
const spinner = (0, ora_1.default)();
|
|
26
|
-
if (!argv.help && !argv.version) {
|
|
26
|
+
if (!argv.help && !argv.version && !argv.v) {
|
|
27
27
|
spinner.start('Initializing...');
|
|
28
28
|
}
|
|
29
29
|
let options = null;
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
2
21
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
23
|
};
|
|
@@ -9,13 +28,11 @@ const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
|
9
28
|
const child_process_promisified_1 = require("./services/child-process-promisified");
|
|
10
29
|
const getDevAccessToken_1 = require("./test/private/getDevAccessToken");
|
|
11
30
|
const sandbox_1 = require("./test/sandbox");
|
|
31
|
+
const packageVersion = __importStar(require("./utils/packageVersion"));
|
|
12
32
|
const TIMEOUT_IN_SECONDS = 10;
|
|
13
33
|
jest.setTimeout(15000);
|
|
34
|
+
const devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
14
35
|
describe('inquirer cli', () => {
|
|
15
|
-
let devAccessToken;
|
|
16
|
-
beforeAll(() => {
|
|
17
|
-
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
18
|
-
});
|
|
19
36
|
it('--version', async () => {
|
|
20
37
|
const res = await runBackportAsync([`--version`]);
|
|
21
38
|
expect(res).toContain(process.env.npm_package_version);
|
|
@@ -24,6 +41,10 @@ describe('inquirer cli', () => {
|
|
|
24
41
|
const res = await runBackportAsync([`-v`]);
|
|
25
42
|
expect(res).toContain(process.env.npm_package_version);
|
|
26
43
|
});
|
|
44
|
+
it('PACKAGE_VERSION should match', async () => {
|
|
45
|
+
// @ts-expect-error
|
|
46
|
+
expect(packageVersion.UNMOCKED_PACKAGE_VERSION).toBe(process.env.npm_package_version);
|
|
47
|
+
});
|
|
27
48
|
it('--help', async () => {
|
|
28
49
|
const res = await runBackportAsync([`--help`]);
|
|
29
50
|
expect(res).toMatchInlineSnapshot(`
|
|
@@ -79,8 +100,7 @@ describe('inquirer cli', () => {
|
|
|
79
100
|
-b, --targetBranch, --branch Branch(es) to backport to [array]
|
|
80
101
|
--targetBranchChoice List branches to backport to [array]
|
|
81
102
|
-l, --targetPRLabel, --label Add labels to the target (backport) PR [array]
|
|
82
|
-
--username
|
|
83
|
-
authenticated user [string]
|
|
103
|
+
--username Defaults to the authenticated user [string]
|
|
84
104
|
--verbose Show additional debug information [boolean]
|
|
85
105
|
--verify Opposite of no-verify [boolean]
|
|
86
106
|
--help Show help [boolean]
|
|
@@ -180,7 +200,7 @@ describe('inquirer cli', () => {
|
|
|
180
200
|
6. Merge pull request #1 from backport-org/add-heart-emoji"
|
|
181
201
|
`);
|
|
182
202
|
});
|
|
183
|
-
it(`should
|
|
203
|
+
it(`should filter commits by "since" and "until"`, async () => {
|
|
184
204
|
jest.setTimeout(TIMEOUT_IN_SECONDS * 1000 * 1.1);
|
|
185
205
|
const output = await runBackportAsync([
|
|
186
206
|
'--branch',
|
|
@@ -192,22 +212,16 @@ describe('inquirer cli', () => {
|
|
|
192
212
|
'--accessToken',
|
|
193
213
|
devAccessToken,
|
|
194
214
|
'--since',
|
|
195
|
-
'2020-08-
|
|
215
|
+
'2020-08-15T10:00:00.000Z',
|
|
196
216
|
'--until',
|
|
197
|
-
'2020-08-
|
|
217
|
+
'2020-08-15T10:30:00.000Z',
|
|
198
218
|
], { waitForString: 'Select commit' });
|
|
199
219
|
expect(output).toMatchInlineSnapshot(`
|
|
200
220
|
"? Select commit (Use arrow keys)
|
|
201
|
-
❯ 1.
|
|
202
|
-
2. Add
|
|
203
|
-
3.
|
|
204
|
-
4.
|
|
205
|
-
5. Add ❤️ emoji
|
|
206
|
-
6. Update .backportrc.json
|
|
207
|
-
7. Bump to 8.0.0
|
|
208
|
-
8. Add package.json
|
|
209
|
-
9. Update .backportrc.json
|
|
210
|
-
10.Create .backportrc.json"
|
|
221
|
+
❯ 1. Bump to 8.0.0
|
|
222
|
+
2. Add package.json
|
|
223
|
+
3. Update .backportrc.json
|
|
224
|
+
4. Create .backportrc.json"
|
|
211
225
|
`);
|
|
212
226
|
});
|
|
213
227
|
it(`should list commits from 7.x`, async () => {
|
|
@@ -237,6 +251,31 @@ describe('inquirer cli', () => {
|
|
|
237
251
|
6. Bump to 8.0.0"
|
|
238
252
|
`);
|
|
239
253
|
});
|
|
254
|
+
describe('repo: different-merge-strategies', () => {
|
|
255
|
+
it('list all commits regardless how they were merged', async () => {
|
|
256
|
+
jest.setTimeout(TIMEOUT_IN_SECONDS * 1000 * 1.1);
|
|
257
|
+
const output = await runBackportAsync([
|
|
258
|
+
'--branch',
|
|
259
|
+
'foo',
|
|
260
|
+
'--repo-owner',
|
|
261
|
+
'backport-org',
|
|
262
|
+
'--repo-name',
|
|
263
|
+
'different-merge-strategies',
|
|
264
|
+
'--accessToken',
|
|
265
|
+
devAccessToken,
|
|
266
|
+
], { waitForString: 'Select commit' });
|
|
267
|
+
expect(output).toMatchInlineSnapshot(`
|
|
268
|
+
"? Select commit (Use arrow keys)
|
|
269
|
+
❯ 1. Using squash to merge commits (#3) 7.x
|
|
270
|
+
2. Rebase strategy: Second commit 7.x
|
|
271
|
+
3. Rebase strategy: First commit
|
|
272
|
+
4. Merge pull request #1 from backport-org/merge-strategy
|
|
273
|
+
5. Merge strategy: Second commit
|
|
274
|
+
6. Merge strategy: First commit
|
|
275
|
+
7. Initial commit"
|
|
276
|
+
`);
|
|
277
|
+
});
|
|
278
|
+
});
|
|
240
279
|
});
|
|
241
280
|
function runBackportAsync(cliArgs, { waitForString, cwd, } = {}) {
|
|
242
281
|
const tsNodeBinary = path_1.default.resolve('./node_modules/.bin/ts-node');
|
|
@@ -4,7 +4,7 @@ const entrypoint_module_1 = require("./entrypoint.module");
|
|
|
4
4
|
const getDevAccessToken_1 = require("./test/private/getDevAccessToken");
|
|
5
5
|
describe('entrypoint.module', () => {
|
|
6
6
|
it('getCommits', async () => {
|
|
7
|
-
const accessToken =
|
|
7
|
+
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
8
8
|
const commits = await (0, entrypoint_module_1.getCommits)({
|
|
9
9
|
accessToken: accessToken,
|
|
10
10
|
repoName: 'backport-e2e',
|
package/dist/options/cliArgs.js
CHANGED
|
@@ -262,7 +262,7 @@ function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
|
262
262
|
string: true,
|
|
263
263
|
})
|
|
264
264
|
.option('username', {
|
|
265
|
-
description: '
|
|
265
|
+
description: 'Defaults to the authenticated user ',
|
|
266
266
|
type: 'string',
|
|
267
267
|
})
|
|
268
268
|
.option('verbose', {
|
|
@@ -139,6 +139,18 @@ describe('getOptionsFromCliArgs', () => {
|
|
|
139
139
|
expect(res.targetBranches).toEqual(['6.0']);
|
|
140
140
|
});
|
|
141
141
|
});
|
|
142
|
+
describe('repo', () => {
|
|
143
|
+
it('splits into repoOwner and repoName', () => {
|
|
144
|
+
const argv = ['--repo', 'elastic/kibana'];
|
|
145
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
146
|
+
expect(res.repoOwner).toEqual('elastic');
|
|
147
|
+
expect(res.repoName).toEqual('kibana');
|
|
148
|
+
});
|
|
149
|
+
it('throw if both --repo and --repo-name is given', () => {
|
|
150
|
+
const argv = ['--repo', 'elastic/kibana', '--repo-name', 'foo'];
|
|
151
|
+
expect(() => (0, cliArgs_1.getOptionsFromCliArgs)(argv, { exitOnError: false })).toThrowError('Arguments repo and repoName are mutually exclusive');
|
|
152
|
+
});
|
|
153
|
+
});
|
|
142
154
|
describe('since/until', () => {
|
|
143
155
|
it('should always be UTC time (configured globally in jest.config.js)', () => {
|
|
144
156
|
expect(new Date().getTimezoneOffset()).toBe(0);
|
|
@@ -56,6 +56,7 @@ export declare function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsF
|
|
|
56
56
|
verbose?: boolean | undefined;
|
|
57
57
|
help?: boolean | undefined;
|
|
58
58
|
version?: boolean | undefined;
|
|
59
|
+
v?: boolean | undefined;
|
|
59
60
|
branchLabelMapping?: Record<string, string> | undefined;
|
|
60
61
|
upstream?: string | undefined;
|
|
61
62
|
branches?: import("../ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getProjectConfig = void 0;
|
|
7
|
-
const
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const find_up_1 = __importDefault(require("find-up"));
|
|
9
9
|
const readConfigFile_1 = require("../config/readConfigFile");
|
|
10
10
|
async function getProjectConfig({ configFile, }) {
|
|
11
11
|
const filepath = configFile
|
|
12
|
-
?
|
|
12
|
+
? path_1.default.resolve(configFile)
|
|
13
13
|
: await (0, find_up_1.default)('.backportrc.json');
|
|
14
14
|
if (!filepath) {
|
|
15
15
|
return;
|
|
@@ -37,6 +37,7 @@ export declare function withConfigMigrations({ upstream, labels, branches, ...co
|
|
|
37
37
|
sourceBranch?: string | undefined;
|
|
38
38
|
username?: string | undefined;
|
|
39
39
|
version?: boolean | undefined;
|
|
40
|
+
v?: boolean | undefined;
|
|
40
41
|
commitPaths?: string[] | undefined;
|
|
41
42
|
reviewers?: string[] | undefined;
|
|
42
43
|
sourcePRLabels?: string[] | undefined;
|
|
@@ -58,6 +58,7 @@ export declare function getOptions(processArgs: string[], optionsFromModule: Con
|
|
|
58
58
|
multiple?: boolean | undefined;
|
|
59
59
|
help?: boolean | undefined;
|
|
60
60
|
version?: boolean | undefined;
|
|
61
|
+
v?: boolean | undefined;
|
|
61
62
|
branchLabelMapping?: Record<string, string> | undefined;
|
|
62
63
|
upstream?: string | undefined;
|
|
63
64
|
branches?: TargetBranchChoiceOrString[] | undefined;
|
package/dist/options/options.js
CHANGED
|
@@ -139,6 +139,8 @@ function throwForRequiredOptions(options) {
|
|
|
139
139
|
'username',
|
|
140
140
|
];
|
|
141
141
|
// Disallow empty strings
|
|
142
|
+
// this is primarily an issue in Github actions where inputs default to empty strings instead of undefined
|
|
143
|
+
// in those cases failing early provides a better UX
|
|
142
144
|
optionKeys.forEach((optionName) => {
|
|
143
145
|
const option = options[optionName];
|
|
144
146
|
if (option === '') {
|
|
@@ -160,7 +160,7 @@ describe('runSequentially', () => {
|
|
|
160
160
|
This will backport the following commits from \`master\` to \`7.x\`:
|
|
161
161
|
- [My commit message](foo)
|
|
162
162
|
|
|
163
|
-
<!--- Backport version: 1.2.3 -->
|
|
163
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
164
164
|
|
|
165
165
|
### Questions ?
|
|
166
166
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
@@ -31,7 +31,7 @@ describe('getPullRequestBody', () => {
|
|
|
31
31
|
This will backport the following commits from \`master\` to \`7.x\`:
|
|
32
32
|
- [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
|
|
33
33
|
|
|
34
|
-
<!--- Backport version: 1.2.3 -->
|
|
34
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
35
35
|
|
|
36
36
|
### Questions ?
|
|
37
37
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
@@ -58,7 +58,7 @@ describe('getPullRequestBody', () => {
|
|
|
58
58
|
This will backport the following commits from \`main\` to \`7.x\`:
|
|
59
59
|
- My commit message (abcdefgh)
|
|
60
60
|
|
|
61
|
-
<!--- Backport version: 1.2.3 -->
|
|
61
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
62
62
|
|
|
63
63
|
### Questions ?
|
|
64
64
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
@@ -103,7 +103,7 @@ describe('getPullRequestBody', () => {
|
|
|
103
103
|
- [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
|
|
104
104
|
- Another commit message (qwertyui)
|
|
105
105
|
|
|
106
|
-
<!--- Backport version: 1.2.3 -->
|
|
106
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
107
107
|
|
|
108
108
|
### Questions ?
|
|
109
109
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
@@ -156,7 +156,7 @@ describe('getPullRequestBody', () => {
|
|
|
156
156
|
- [Merge strategy: Second commit](https://github.com/backport-org/different-merge-strategies/pull/1)
|
|
157
157
|
- [Merge strategy: First commit](https://github.com/backport-org/different-merge-strategies/pull/1)
|
|
158
158
|
|
|
159
|
-
<!--- Backport version: 1.2.3 -->
|
|
159
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
160
160
|
|
|
161
161
|
### Questions ?
|
|
162
162
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
@@ -243,7 +243,7 @@ describe('getPullRequestBody', () => {
|
|
|
243
243
|
- [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
|
|
244
244
|
- Another commit message (qwertyui)
|
|
245
245
|
|
|
246
|
-
<!--- Backport version: 1.2.3 -->
|
|
246
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
247
247
|
|
|
248
248
|
### Questions ?
|
|
249
249
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
@@ -65,7 +65,7 @@ describe('getCommentBody', () => {
|
|
|
65
65
|
|
|
66
66
|
### Questions ?
|
|
67
67
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
68
|
-
<!--- Backport version: 1.2.3 -->"
|
|
68
|
+
<!--- Backport version: 1.2.3-mocked -->"
|
|
69
69
|
`);
|
|
70
70
|
});
|
|
71
71
|
it('does not post a comment when running manually', () => {
|
|
@@ -114,7 +114,7 @@ describe('getCommentBody', () => {
|
|
|
114
114
|
|
|
115
115
|
### Questions ?
|
|
116
116
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
117
|
-
<!--- Backport version: 1.2.3 -->"
|
|
117
|
+
<!--- Backport version: 1.2.3-mocked -->"
|
|
118
118
|
`);
|
|
119
119
|
});
|
|
120
120
|
it('posts a comment when running locally', () => {
|
|
@@ -131,7 +131,7 @@ describe('getCommentBody', () => {
|
|
|
131
131
|
|
|
132
132
|
### Questions ?
|
|
133
133
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
134
|
-
<!--- Backport version: 1.2.3 -->"
|
|
134
|
+
<!--- Backport version: 1.2.3-mocked -->"
|
|
135
135
|
`);
|
|
136
136
|
});
|
|
137
137
|
});
|
|
@@ -179,7 +179,7 @@ describe('getCommentBody', () => {
|
|
|
179
179
|
|
|
180
180
|
### Questions ?
|
|
181
181
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
182
|
-
<!--- Backport version: 1.2.3 -->"
|
|
182
|
+
<!--- Backport version: 1.2.3-mocked -->"
|
|
183
183
|
`);
|
|
184
184
|
});
|
|
185
185
|
it('does not post a comment when running manaully', () => {
|
|
@@ -233,7 +233,7 @@ describe('getCommentBody', () => {
|
|
|
233
233
|
|
|
234
234
|
### Questions ?
|
|
235
235
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
236
|
-
<!--- Backport version: 1.2.3 -->"
|
|
236
|
+
<!--- Backport version: 1.2.3-mocked -->"
|
|
237
237
|
`);
|
|
238
238
|
});
|
|
239
239
|
it('does not post a comment when running manually because some backports failed', () => {
|
|
@@ -338,7 +338,7 @@ describe('getCommentBody', () => {
|
|
|
338
338
|
|
|
339
339
|
### Questions ?
|
|
340
340
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
341
|
-
<!--- Backport version: 1.2.3 -->"
|
|
341
|
+
<!--- Backport version: 1.2.3-mocked -->"
|
|
342
342
|
`);
|
|
343
343
|
});
|
|
344
344
|
it('does not post a comment when running manually because some backports failed', () => {
|
|
@@ -375,7 +375,7 @@ describe('getCommentBody', () => {
|
|
|
375
375
|
|
|
376
376
|
### Questions ?
|
|
377
377
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
378
|
-
<!--- Backport version: 1.2.3 -->"
|
|
378
|
+
<!--- Backport version: 1.2.3-mocked -->"
|
|
379
379
|
`);
|
|
380
380
|
});
|
|
381
381
|
it('does not post a comment when running manually', () => {
|
|
@@ -63,7 +63,7 @@ describe.skip('enablePullRequestAutoMerge', () => {
|
|
|
63
63
|
let octokit;
|
|
64
64
|
let options;
|
|
65
65
|
beforeAll(async () => {
|
|
66
|
-
const accessToken =
|
|
66
|
+
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
67
67
|
const randomString = crypto_1.default.randomBytes(4).toString('hex');
|
|
68
68
|
branchName = `test-${randomString}`;
|
|
69
69
|
options = {
|
|
@@ -62,6 +62,7 @@ export declare function getOptionsFromGithub(options: {
|
|
|
62
62
|
verbose?: boolean | undefined;
|
|
63
63
|
help?: boolean | undefined;
|
|
64
64
|
version?: boolean | undefined;
|
|
65
|
+
v?: boolean | undefined;
|
|
65
66
|
branchLabelMapping?: Record<string, string> | undefined;
|
|
66
67
|
upstream?: string | undefined;
|
|
67
68
|
branches?: import("../../../../options/ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
@@ -22,13 +22,7 @@ function getMockSourceCommit({ sourceCommit, sourcePullRequest, timelineItems =
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
return {
|
|
25
|
-
|
|
26
|
-
name: 'kibana',
|
|
27
|
-
owner: { login: 'elastic' },
|
|
28
|
-
},
|
|
29
|
-
committedDate: sourceCommit.commitedDate ?? '2021-12-22T00:00:00Z',
|
|
30
|
-
sha: sourceCommit.sha ?? defaultSourceCommitSha,
|
|
31
|
-
message: sourceCommit.message,
|
|
25
|
+
...baseMockCommit,
|
|
32
26
|
associatedPullRequests: {
|
|
33
27
|
edges: [
|
|
34
28
|
{
|
|
@@ -29,7 +29,7 @@ describe('backport e2e', () => {
|
|
|
29
29
|
beforeAll(async () => {
|
|
30
30
|
// set alternative homedir
|
|
31
31
|
jest.spyOn(os_1.default, 'homedir').mockReturnValue(`${sandboxPath}/homedir`);
|
|
32
|
-
accessToken =
|
|
32
|
+
accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
33
33
|
(0, mockConfigFiles_1.mockConfigFiles)({
|
|
34
34
|
globalConfig: {},
|
|
35
35
|
projectConfig: {},
|
|
@@ -78,7 +78,7 @@ describe('backport e2e', () => {
|
|
|
78
78
|
This will backport the following commits from \`master\` to \`7.x\`:
|
|
79
79
|
- Add ❤️ emoji (5bf29b7d)
|
|
80
80
|
|
|
81
|
-
<!--- Backport version: 1.2.3 -->
|
|
81
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
82
82
|
|
|
83
83
|
### Questions ?
|
|
84
84
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
@@ -150,7 +150,7 @@ describe('backport e2e', () => {
|
|
|
150
150
|
- Add ❤️ emoji (5bf29b7d)
|
|
151
151
|
- Add family emoji (#2) (59d6ff1c)
|
|
152
152
|
|
|
153
|
-
<!--- Backport version: 1.2.3 -->
|
|
153
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
154
154
|
|
|
155
155
|
### Questions ?
|
|
156
156
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
@@ -225,7 +225,7 @@ describe('backport e2e', () => {
|
|
|
225
225
|
This will backport the following commits from \`master\` to \`7.x\`:
|
|
226
226
|
- Add ❤️ emoji (5bf29b7d)
|
|
227
227
|
|
|
228
|
-
<!--- Backport version: 1.2.3 -->
|
|
228
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
229
229
|
|
|
230
230
|
### Questions ?
|
|
231
231
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
@@ -8,7 +8,7 @@ jest.unmock('find-up');
|
|
|
8
8
|
jest.setTimeout(15000);
|
|
9
9
|
describe('Handle unbackported pull requests', () => {
|
|
10
10
|
it('shows missing backports for PR number 8', async () => {
|
|
11
|
-
const accessToken =
|
|
11
|
+
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
12
12
|
const commits = await (0, entrypoint_module_1.getCommits)({
|
|
13
13
|
accessToken: accessToken,
|
|
14
14
|
repoOwner: 'backport-org',
|
|
@@ -35,7 +35,7 @@ describe('Handle unbackported pull requests', () => {
|
|
|
35
35
|
expect(commits[0]).toEqual(expectedCommit);
|
|
36
36
|
});
|
|
37
37
|
it('shows that backport failed because PR number 8 was not backported', async () => {
|
|
38
|
-
const accessToken =
|
|
38
|
+
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
39
39
|
const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
|
|
40
40
|
await (0, sandbox_1.resetSandbox)(sandboxPath);
|
|
41
41
|
await (0, child_process_promisified_1.exec)('git init', { cwd: sandboxPath });
|
|
@@ -31,7 +31,11 @@ jest.mock('find-up', () => {
|
|
|
31
31
|
});
|
|
32
32
|
// @ts-expect-error
|
|
33
33
|
// eslint-disable-next-line no-import-assign
|
|
34
|
-
packageVersionModule.
|
|
34
|
+
packageVersionModule.UNMOCKED_PACKAGE_VERSION =
|
|
35
|
+
packageVersionModule.PACKAGE_VERSION;
|
|
36
|
+
// @ts-expect-error
|
|
37
|
+
// eslint-disable-next-line no-import-assign
|
|
38
|
+
packageVersionModule.PACKAGE_VERSION = '1.2.3-mocked';
|
|
35
39
|
jest.mock('make-dir', () => {
|
|
36
40
|
return jest.fn(() => Promise.resolve('/some/path'));
|
|
37
41
|
});
|
|
@@ -131,7 +131,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
131
131
|
- [My original commit message (#1000)](foo)
|
|
132
132
|
- [My other commit message (#2000)](foo)
|
|
133
133
|
|
|
134
|
-
<!--- Backport version: 1.2.3 -->
|
|
134
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
135
135
|
|
|
136
136
|
### Questions ?
|
|
137
137
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
@@ -219,7 +219,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
219
219
|
This will backport the following commits from \`7.x\` to \`6.x\`:
|
|
220
220
|
- My original commit message (mySha)
|
|
221
221
|
|
|
222
|
-
<!--- Backport version: 1.2.3 -->
|
|
222
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
223
223
|
|
|
224
224
|
### Questions ?
|
|
225
225
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
@@ -295,7 +295,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
295
295
|
This will backport the following commits from \`7.x\` to \`6.x\`:
|
|
296
296
|
- My original commit message (mySha)
|
|
297
297
|
|
|
298
|
-
<!--- Backport version: 1.2.3 -->
|
|
298
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
299
299
|
|
|
300
300
|
### Questions ?
|
|
301
301
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "
|
|
1
|
+
export declare const PACKAGE_VERSION = "7.0.1";
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"branches",
|
|
15
15
|
"branching"
|
|
16
16
|
],
|
|
17
|
-
"version": "
|
|
17
|
+
"version": "7.0.1",
|
|
18
18
|
"main": "./dist/entrypoint.module.js",
|
|
19
19
|
"types": "dist/entrypoint.module.d.ts",
|
|
20
20
|
"bin": {
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"del": "^6.0.0",
|
|
69
69
|
"dotenv": "^16.0.0",
|
|
70
70
|
"find-up": "^5.0.0",
|
|
71
|
+
"graphql": "^16.3.0",
|
|
71
72
|
"graphql-tag": "^2.12.6",
|
|
72
73
|
"inquirer": "^8.2.0",
|
|
73
74
|
"lodash": "^4.17.21",
|
|
@@ -91,24 +92,23 @@
|
|
|
91
92
|
"@types/safe-json-stringify": "^1.1.2",
|
|
92
93
|
"@types/yargs": "^17.0.8",
|
|
93
94
|
"@types/yargs-parser": "^20.2.1",
|
|
94
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
95
|
-
"@typescript-eslint/parser": "^5.
|
|
95
|
+
"@typescript-eslint/eslint-plugin": "^5.11.0",
|
|
96
|
+
"@typescript-eslint/parser": "^5.11.0",
|
|
96
97
|
"eslint": "^8.8.0",
|
|
97
98
|
"eslint-config-prettier": "^8.3.0",
|
|
98
99
|
"eslint-plugin-import": "^2.25.4",
|
|
99
|
-
"eslint-plugin-jest": "^26.
|
|
100
|
+
"eslint-plugin-jest": "^26.1.0",
|
|
100
101
|
"eslint-plugin-prettier": "^4.0.0",
|
|
101
|
-
"graphql": "^16.3.0",
|
|
102
102
|
"graphql-config": "^4.1.0",
|
|
103
103
|
"husky": "^7.0.4",
|
|
104
|
-
"jest": "^27.
|
|
104
|
+
"jest": "^27.5.1",
|
|
105
105
|
"jest-snapshot-serializer-ansi": "^1.0.0",
|
|
106
106
|
"lint-staged": "^12.3.3",
|
|
107
107
|
"nock": "^13.2.4",
|
|
108
108
|
"prettier": "^2.5.1",
|
|
109
109
|
"strip-ansi": "^6.0.1",
|
|
110
110
|
"ts-jest": "^27.1.3",
|
|
111
|
-
"ts-node": "^10.
|
|
111
|
+
"ts-node": "^10.5.0",
|
|
112
112
|
"typescript": "^4.5.5"
|
|
113
113
|
}
|
|
114
114
|
}
|