backport 8.3.1 → 8.4.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/lib/child-process-promisified.js +2 -2
- package/dist/lib/git.js +1 -0
- package/dist/lib/git.test.js +26 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +1 -0
- package/dist/options/ConfigOptions.d.ts +1 -0
- package/dist/options/cliArgs.d.ts +1 -0
- package/dist/options/cliArgs.js +5 -0
- package/dist/options/config/config.d.ts +1 -0
- package/dist/options/config/readConfigFile.d.ts +1 -0
- package/dist/options/options.d.ts +2 -0
- package/dist/options/options.js +1 -0
- package/dist/options/options.test.js +1 -0
- package/dist/test/e2e/cli/entrypoint.cli.private.test.js +2 -0
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +3 -4
- package/dist/entrypoint.cli.private.test.d.ts +0 -1
- package/dist/entrypoint.cli.private.test.js +0 -47
- package/dist/errors/BackportError.d.ts +0 -19
- package/dist/errors/BackportError.js +0 -29
- package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.d.ts +0 -1
- package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.js +0 -112
- package/dist/runSequentially.test.d.ts +0 -1
- package/dist/runSequentially.test.js +0 -243
- package/dist/services/BackportError.d.ts +0 -19
- package/dist/services/BackportError.js +0 -29
- package/dist/services/HandledBackportError.d.ts +0 -19
- package/dist/services/HandledBackportError.js +0 -29
- package/dist/services/HandledError.d.ts +0 -19
- package/dist/services/HandledError.js +0 -29
- package/dist/services/child-process-promisified.d.ts +0 -25
- package/dist/services/child-process-promisified.js +0 -58
- package/dist/services/env.d.ts +0 -7
- package/dist/services/env.js +0 -30
- package/dist/services/env.test.d.ts +0 -1
- package/dist/services/env.test.js +0 -21
- package/dist/services/git.d.ts +0 -77
- package/dist/services/git.integration.test.d.ts +0 -1
- package/dist/services/git.integration.test.js +0 -616
- package/dist/services/git.js +0 -439
- package/dist/services/git.private.test.d.ts +0 -1
- package/dist/services/git.private.test.js +0 -618
- package/dist/services/git.test.d.ts +0 -1
- package/dist/services/git.test.js +0 -580
- package/dist/services/github/commitFormatters.d.ts +0 -3
- package/dist/services/github/commitFormatters.js +0 -17
- package/dist/services/github/commitFormatters.test.d.ts +0 -1
- package/dist/services/github/commitFormatters.test.js +0 -11
- package/dist/services/github/v3/addAssigneesToPullRequest.d.ts +0 -2
- package/dist/services/github/v3/addAssigneesToPullRequest.js +0 -32
- package/dist/services/github/v3/addAssigneesToPullRequest.test.d.ts +0 -1
- package/dist/services/github/v3/addAssigneesToPullRequest.test.js +0 -27
- package/dist/services/github/v3/addLabelsToPullRequest.d.ts +0 -2
- package/dist/services/github/v3/addLabelsToPullRequest.js +0 -30
- package/dist/services/github/v3/addReviewersToPullRequest.d.ts +0 -2
- package/dist/services/github/v3/addReviewersToPullRequest.js +0 -32
- package/dist/services/github/v3/createPullRequest.d.ts +0 -29
- package/dist/services/github/v3/createPullRequest.js +0 -91
- package/dist/services/github/v3/createPullRequest.test.d.ts +0 -1
- package/dist/services/github/v3/createPullRequest.test.js +0 -377
- package/dist/services/github/v3/createStatusComment.d.ts +0 -11
- package/dist/services/github/v3/createStatusComment.js +0 -131
- package/dist/services/github/v3/createStatusComment.test.d.ts +0 -1
- package/dist/services/github/v3/createStatusComment.test.js +0 -409
- package/dist/services/github/v3/getGithubV3ErrorMessage.d.ts +0 -14
- package/dist/services/github/v3/getGithubV3ErrorMessage.js +0 -16
- package/dist/services/github/v4/FetchPullRequestId.d.ts +0 -2
- package/dist/services/github/v4/FetchPullRequestId.js +0 -36
- package/dist/services/github/v4/apiRequestV4.d.ts +0 -31
- package/dist/services/github/v4/apiRequestV4.js +0 -71
- package/dist/services/github/v4/apiRequestV4.test.d.ts +0 -1
- package/dist/services/github/v4/apiRequestV4.test.js +0 -109
- package/dist/services/github/v4/disablePullRequestAutoMerge.d.ts +0 -2
- package/dist/services/github/v4/disablePullRequestAutoMerge.js +0 -32
- package/dist/services/github/v4/enablePullRequestAutoMerge.d.ts +0 -2
- package/dist/services/github/v4/enablePullRequestAutoMerge.js +0 -50
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.d.ts +0 -1
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +0 -112
- package/dist/services/github/v4/fetchAuthorId.d.ts +0 -10
- package/dist/services/github/v4/fetchAuthorId.js +0 -28
- package/dist/services/github/v4/fetchAuthorId.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchAuthorId.private.test.js +0 -25
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +0 -93
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +0 -11
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +0 -58
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +0 -136
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.d.ts +0 -11
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +0 -48
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +0 -118
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +0 -29
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +0 -110
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +0 -196
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +0 -157
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +0 -3
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +0 -61
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +0 -107
- package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.d.ts +0 -12
- package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +0 -69
- package/dist/services/github/v4/fetchExistingPullRequest.d.ts +0 -9
- package/dist/services/github/v4/fetchExistingPullRequest.js +0 -64
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +0 -44
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +0 -2
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.js +0 -39
- package/dist/services/github/v4/fetchRemoteProjectConfig.d.ts +0 -8
- package/dist/services/github/v4/fetchRemoteProjectConfig.js +0 -49
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +0 -49
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +0 -69
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +0 -73
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +0 -1
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +0 -116
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +0 -16
- package/dist/services/github/v4/getOptionsFromGithub/query.js +0 -29
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +0 -29
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.js +0 -61
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.d.ts +0 -1
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +0 -72
- package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +0 -176
- package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +0 -6
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +0 -45
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.d.ts +0 -1
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +0 -87
- package/dist/services/logger.d.ts +0 -9
- package/dist/services/logger.js +0 -74
- package/dist/services/prompt.test.d.ts +0 -1
- package/dist/services/prompt.test.js +0 -139
- package/dist/services/prompts.d.ts +0 -17
- package/dist/services/prompts.js +0 -132
- package/dist/services/remoteConfig.d.ts +0 -20
- package/dist/services/remoteConfig.js +0 -52
- package/dist/services/sequentially.d.ts +0 -1
- package/dist/services/sequentially.js +0 -10
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +0 -16
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +0 -102
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +0 -1
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +0 -467
- package/dist/services/sourceCommit/getMockSourceCommit.d.ts +0 -26
- package/dist/services/sourceCommit/getMockSourceCommit.js +0 -103
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +0 -108
- package/dist/services/sourceCommit/parseSourceCommit.js +0 -123
- package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit/parseSourceCommit.test.js +0 -226
- package/dist/services/test.d.ts +0 -1
- package/dist/services/test.js +0 -23
- package/dist/state.d.ts +0 -0
- package/dist/state.js +0 -1
- package/dist/test/ExecError.d.ts +0 -16
- package/dist/test/ExecError.js +0 -15
- package/dist/test/e2e/cli/cli.private.test.d.ts +0 -1
- package/dist/test/e2e/cli/cli.private.test.js +0 -222
- package/dist/test/e2e/cli/date-filters.d.ts +0 -1
- package/dist/test/e2e/cli/date-filters.js +0 -43
- package/dist/test/e2e/cli/interactive-error-handling.private.test.d.ts +0 -1
- package/dist/test/e2e/cli/interactive-error-handling.private.test.js +0 -80
- package/dist/test/e2e/cli/non-interactive-error-handling.private.test.d.ts +0 -1
- package/dist/test/e2e/cli/non-interactive-error-handling.private.test.js +0 -198
- package/dist/test/e2e/cli.e2e.private.test.d.ts +0 -1
- package/dist/test/e2e/cli.e2e.private.test.js +0 -433
- package/dist/test/e2e/module/module.mutation.test.d.ts +0 -1
- package/dist/test/e2e/module/module.mutation.test.js +0 -369
- package/dist/test/e2e/module.e2e.mutation.test.d.ts +0 -1
- package/dist/test/e2e/module.e2e.mutation.test.js +0 -369
- package/dist/test/e2e/module.e2e.private.test.d.ts +0 -1
- package/dist/test/e2e/module.e2e.private.test.js +0 -369
- package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +0 -13
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +0 -243
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +0 -320
- package/dist/ui/getCommits.d.ts +0 -2
- package/dist/ui/getCommits.js +0 -75
- package/dist/ui/getCommitsWithoutBackports.d.ts +0 -11
- package/dist/ui/getCommitsWithoutBackports.js +0 -68
- package/dist/ui/getCommitsWithoutBackports.test.d.ts +0 -1
- package/dist/ui/getCommitsWithoutBackports.test.js +0 -335
- package/dist/ui/getGitConfigAuthor.d.ts +0 -6
- package/dist/ui/getGitConfigAuthor.js +0 -15
- package/dist/ui/getTargetBranches.d.ts +0 -5
- package/dist/ui/getTargetBranches.js +0 -67
- package/dist/ui/getTargetBranches.test.d.ts +0 -1
- package/dist/ui/getTargetBranches.test.js +0 -204
- package/dist/ui/maybeSetupRepo.d.ts +0 -2
- package/dist/ui/maybeSetupRepo.js +0 -53
- package/dist/ui/maybeSetupRepo.test.d.ts +0 -1
- package/dist/ui/maybeSetupRepo.test.js +0 -238
- package/dist/ui/ora.d.ts +0 -2
- package/dist/ui/ora.js +0 -21
- package/dist/ui/setupRepo.d.ts +0 -2
- package/dist/ui/setupRepo.js +0 -56
- package/dist/ui/setupRepo.test.d.ts +0 -1
- package/dist/ui/setupRepo.test.js +0 -273
- package/dist/utils/filterMissingCommits.d.ts +0 -2
- package/dist/utils/filterMissingCommits.js +0 -7
- package/dist/utils/redact.d.ts +0 -1
- package/dist/utils/redact.js +0 -7
|
@@ -17,6 +17,8 @@ async function exec(cmd, options) {
|
|
|
17
17
|
}
|
|
18
18
|
exports.exec = exec;
|
|
19
19
|
async function spawnPromise(cmd, cmdArgs, cwd) {
|
|
20
|
+
const fullCmd = `${cmd} ${cmdArgs.join(' ')}`;
|
|
21
|
+
logger_1.logger.info(`Running command: "${fullCmd}"`);
|
|
20
22
|
return new Promise(function (resolve, reject) {
|
|
21
23
|
const subprocess = child_process_1.default.spawn(cmd, cmdArgs, { cwd });
|
|
22
24
|
let stderr = '';
|
|
@@ -28,8 +30,6 @@ async function spawnPromise(cmd, cmdArgs, cwd) {
|
|
|
28
30
|
stderr += data;
|
|
29
31
|
});
|
|
30
32
|
subprocess.on('close', (code) => {
|
|
31
|
-
const fullCmd = `${cmd} ${cmdArgs.join(' ')}`;
|
|
32
|
-
logger_1.logger.info(`Running command: "${fullCmd}"`);
|
|
33
33
|
if (code === 0 || code === null) {
|
|
34
34
|
resolve({ cmdArgs, code, stderr, stdout });
|
|
35
35
|
}
|
package/dist/lib/git.js
CHANGED
|
@@ -229,6 +229,7 @@ async function cherrypick({ options, sha, mergedTargetPullRequest, commitAuthor,
|
|
|
229
229
|
? ['--mainline', `${options.mainline}`]
|
|
230
230
|
: []),
|
|
231
231
|
...(options.cherrypickRef === false ? [] : ['-x']),
|
|
232
|
+
...(options.signoff ? ['--signoff'] : []),
|
|
232
233
|
shaOrRange,
|
|
233
234
|
];
|
|
234
235
|
try {
|
package/dist/lib/git.test.js
CHANGED
|
@@ -340,6 +340,32 @@ describe('cherrypick', () => {
|
|
|
340
340
|
'/myHomeDir/.backport/repositories/elastic/kibana',
|
|
341
341
|
]);
|
|
342
342
|
});
|
|
343
|
+
it('should use signoff option when specified', async () => {
|
|
344
|
+
const spawnSpy = jest
|
|
345
|
+
.spyOn(childProcess, 'spawnPromise')
|
|
346
|
+
.mockResolvedValueOnce({ stderr: '', stdout: '', code: 0, cmdArgs: [] }) // mock getIsMergeCommit(...)
|
|
347
|
+
.mockResolvedValueOnce({ stderr: '', stdout: '', code: 0, cmdArgs: [] }); // mock cherrypick(...)
|
|
348
|
+
await (0, git_1.cherrypick)({
|
|
349
|
+
options: { ...options, signoff: true },
|
|
350
|
+
sha: 'abcd',
|
|
351
|
+
commitAuthor,
|
|
352
|
+
});
|
|
353
|
+
const args = spawnSpy.mock.calls[1];
|
|
354
|
+
expect(args).toEqual([
|
|
355
|
+
'git',
|
|
356
|
+
[
|
|
357
|
+
'-c',
|
|
358
|
+
'user.name="Soren L"',
|
|
359
|
+
'-c',
|
|
360
|
+
'user.email="soren@mail.dk"',
|
|
361
|
+
'cherry-pick',
|
|
362
|
+
'-x',
|
|
363
|
+
'--signoff',
|
|
364
|
+
'abcd',
|
|
365
|
+
],
|
|
366
|
+
'/myHomeDir/.backport/repositories/elastic/kibana',
|
|
367
|
+
]);
|
|
368
|
+
});
|
|
343
369
|
it('should return `needsResolving: true` upon cherrypick error', async () => {
|
|
344
370
|
jest
|
|
345
371
|
.spyOn(childProcess, 'spawnPromise')
|
|
@@ -61,6 +61,7 @@ export declare function getOptionsFromGithub(options: {
|
|
|
61
61
|
targetBranchChoices?: import("../../../../options/ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
62
62
|
targetBranches?: string[] | undefined;
|
|
63
63
|
targetPRLabels?: string[] | undefined;
|
|
64
|
+
signoff?: boolean | undefined;
|
|
64
65
|
help?: boolean | undefined;
|
|
65
66
|
version?: boolean | undefined;
|
|
66
67
|
v?: boolean | undefined;
|
|
@@ -28,6 +28,7 @@ export declare function getOptionsFromCliArgs(processArgs: readonly string[]): {
|
|
|
28
28
|
gitAuthorEmail?: string | undefined;
|
|
29
29
|
ls?: boolean | undefined;
|
|
30
30
|
mainline?: number | undefined;
|
|
31
|
+
signoff?: boolean | undefined;
|
|
31
32
|
maxNumber?: number | undefined;
|
|
32
33
|
multipleBranches?: boolean | undefined;
|
|
33
34
|
multipleCommits?: boolean | undefined;
|
package/dist/options/cliArgs.js
CHANGED
|
@@ -176,6 +176,11 @@ function getOptionsFromCliArgs(processArgs) {
|
|
|
176
176
|
// Invalid value provided
|
|
177
177
|
throw new Error(`--mainline must be an integer. Received: ${mainline}`);
|
|
178
178
|
},
|
|
179
|
+
})
|
|
180
|
+
.option('signoff', {
|
|
181
|
+
description: 'Pass the --signoff option to the cherry-pick command',
|
|
182
|
+
type: 'boolean',
|
|
183
|
+
alias: ['s'],
|
|
179
184
|
})
|
|
180
185
|
// display 10 commits to pick from
|
|
181
186
|
.option('maxNumber', {
|
|
@@ -58,6 +58,7 @@ export declare function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsF
|
|
|
58
58
|
targetBranchChoices?: import("../ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
59
59
|
targetBranches?: string[] | undefined;
|
|
60
60
|
targetPRLabels?: string[] | undefined;
|
|
61
|
+
signoff?: boolean | undefined;
|
|
61
62
|
help?: boolean | undefined;
|
|
62
63
|
version?: boolean | undefined;
|
|
63
64
|
v?: boolean | undefined;
|
|
@@ -24,6 +24,7 @@ export declare function withConfigMigrations({ upstream, labels, branches, ...co
|
|
|
24
24
|
gitAuthorName?: string | undefined;
|
|
25
25
|
gitAuthorEmail?: string | undefined;
|
|
26
26
|
ls?: boolean | undefined;
|
|
27
|
+
signoff?: boolean | undefined;
|
|
27
28
|
maxNumber?: number | undefined;
|
|
28
29
|
multiple?: boolean | undefined;
|
|
29
30
|
multipleBranches?: boolean | undefined;
|
|
@@ -29,6 +29,7 @@ export declare const defaultConfigOptions: {
|
|
|
29
29
|
targetBranchChoices: TargetBranchChoiceOrString[];
|
|
30
30
|
targetBranches: string[];
|
|
31
31
|
targetPRLabels: string[];
|
|
32
|
+
signoff: boolean;
|
|
32
33
|
};
|
|
33
34
|
export declare function getOptions({ optionsFromCliArgs, optionsFromModule, }: {
|
|
34
35
|
optionsFromCliArgs: OptionsFromCliArgs;
|
|
@@ -63,6 +64,7 @@ export declare function getOptions({ optionsFromCliArgs, optionsFromModule, }: {
|
|
|
63
64
|
gitAuthorEmail?: string | undefined;
|
|
64
65
|
ls?: boolean | undefined;
|
|
65
66
|
mainline?: number | undefined;
|
|
67
|
+
signoff: boolean;
|
|
66
68
|
maxNumber: number;
|
|
67
69
|
multipleBranches: boolean;
|
|
68
70
|
multipleCommits: boolean;
|
package/dist/options/options.js
CHANGED
|
@@ -38,6 +38,7 @@ exports.defaultConfigOptions = {
|
|
|
38
38
|
targetBranchChoices: [],
|
|
39
39
|
targetBranches: [],
|
|
40
40
|
targetPRLabels: [],
|
|
41
|
+
signoff: false,
|
|
41
42
|
};
|
|
42
43
|
async function getOptions({ optionsFromCliArgs, optionsFromModule, }) {
|
|
43
44
|
const optionsFromConfigFiles = await (0, config_1.getOptionsFromConfigFiles)({
|
|
@@ -82,6 +82,8 @@ describe('entrypoint cli', () => {
|
|
|
82
82
|
--ls List commits instead of backporting them [boolean]
|
|
83
83
|
--mainline Parent id of merge commit. Defaults to 1 when supplied
|
|
84
84
|
without arguments [number]
|
|
85
|
+
-s, --signoff Pass the --signoff option to the cherry-pick command
|
|
86
|
+
[boolean]
|
|
85
87
|
-n, --maxNumber, --number Number of commits to choose from [number]
|
|
86
88
|
--multiple Select multiple branches/commits [boolean]
|
|
87
89
|
--multipleBranches Backport to multiple branches [boolean]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "8.
|
|
1
|
+
export declare const PACKAGE_VERSION = "8.4.0";
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"branches",
|
|
15
15
|
"branching"
|
|
16
16
|
],
|
|
17
|
-
"version": "8.
|
|
17
|
+
"version": "8.4.0",
|
|
18
18
|
"main": "./dist/entrypoint.module.js",
|
|
19
19
|
"types": "dist/entrypoint.module.d.ts",
|
|
20
20
|
"bin": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"postinstall": "test -f ./dist/scripts/runPostinstall.js && node ./dist/scripts/runPostinstall.js || echo 'Dist folder missing'",
|
|
26
26
|
"version": "echo \"Bumping version\" && yarn extractPackageVersion && git add src/utils/packageVersion.ts && yarn tsc",
|
|
27
27
|
"prepare": "husky install",
|
|
28
|
-
"prepublishOnly": "yarn lint && yarn tsc",
|
|
28
|
+
"prepublishOnly": "rm -rf ./dist/ && yarn lint && yarn tsc",
|
|
29
29
|
"extractPackageVersion": "node -p \"'export const PACKAGE_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" | prettier --parser typescript > src/utils/packageVersion.ts",
|
|
30
30
|
"lint-and-test": "yarn tsc && yarn lint && yarn test-all",
|
|
31
31
|
"lint": "echo \"Running lint\" && eslint './**/*.{ts,js}'",
|
|
@@ -33,8 +33,7 @@
|
|
|
33
33
|
"test-all": "rm -rf src/test/_tmp_sandbox_ && jest --config ./jest.config.all.js",
|
|
34
34
|
"test-mutation": "jest --config ./jest.config.mutation.js",
|
|
35
35
|
"test-private": "jest --config ./jest.config.private.js",
|
|
36
|
-
"test": "jest"
|
|
37
|
-
"docker-run": "./docker/build-and-run-dockerfile.sh"
|
|
36
|
+
"test": "jest"
|
|
38
37
|
},
|
|
39
38
|
"lint-staged": {
|
|
40
39
|
"*.ts": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
it('getCommits', async () => {
|
|
7
|
-
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
8
|
-
const commits = await (0, entrypoint_module_1.getCommits)({
|
|
9
|
-
accessToken: accessToken,
|
|
10
|
-
repoName: 'backport-e2e',
|
|
11
|
-
repoOwner: 'backport-org',
|
|
12
|
-
pullNumber: 2,
|
|
13
|
-
});
|
|
14
|
-
const expectedCommits = [
|
|
15
|
-
{
|
|
16
|
-
author: { email: 'sorenlouv@gmail.com', name: 'Søren Louv-Jansen' },
|
|
17
|
-
sourceCommit: {
|
|
18
|
-
committedDate: '2020-08-15T10:44:04Z',
|
|
19
|
-
message: 'Add family emoji (#2)',
|
|
20
|
-
sha: '59d6ff1ca90a4ce210c0a4f0e159214875c19d60',
|
|
21
|
-
},
|
|
22
|
-
sourcePullRequest: {
|
|
23
|
-
number: 2,
|
|
24
|
-
url: 'https://github.com/backport-org/backport-e2e/pull/2',
|
|
25
|
-
mergeCommit: {
|
|
26
|
-
message: 'Add family emoji (#2)',
|
|
27
|
-
sha: '59d6ff1ca90a4ce210c0a4f0e159214875c19d60',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
sourceBranch: 'master',
|
|
31
|
-
expectedTargetPullRequests: [
|
|
32
|
-
{
|
|
33
|
-
branch: '7.x',
|
|
34
|
-
number: 4,
|
|
35
|
-
state: 'MERGED',
|
|
36
|
-
url: 'https://github.com/backport-org/backport-e2e/pull/4',
|
|
37
|
-
mergeCommit: {
|
|
38
|
-
message: 'Add family emoji (#2) (#4)',
|
|
39
|
-
sha: 'f8b4f6ae7ffaf2732fa5e33e98b3ea772bdfff1d',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
];
|
|
45
|
-
expect(commits).toEqual(expectedCommits);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Commit } from '../lib/sourceCommit/parseSourceCommit';
|
|
2
|
-
declare type ErrorContext = {
|
|
3
|
-
code: 'merge-conflict-exception';
|
|
4
|
-
conflictingFiles: string[];
|
|
5
|
-
commitsWithoutBackports: {
|
|
6
|
-
formatted: string;
|
|
7
|
-
commit: Commit;
|
|
8
|
-
}[];
|
|
9
|
-
} | {
|
|
10
|
-
code: 'message-only-exception';
|
|
11
|
-
message: string;
|
|
12
|
-
} | {
|
|
13
|
-
code: 'no-branches-exception' | 'abort-exception';
|
|
14
|
-
};
|
|
15
|
-
export declare class BackportError extends Error {
|
|
16
|
-
errorContext: ErrorContext;
|
|
17
|
-
constructor(errorContextOrString: ErrorContext | string);
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BackportError = void 0;
|
|
4
|
-
function getMessage(errorContext) {
|
|
5
|
-
switch (errorContext.code) {
|
|
6
|
-
case 'merge-conflict-exception':
|
|
7
|
-
return `Commit could not be cherrypicked due to conflicts in: ${errorContext.conflictingFiles.join(',')}`;
|
|
8
|
-
case 'no-branches-exception':
|
|
9
|
-
return 'There are no branches to backport to. Aborting.';
|
|
10
|
-
case 'abort-exception':
|
|
11
|
-
return 'Aborted';
|
|
12
|
-
case 'message-only-exception':
|
|
13
|
-
return errorContext.message;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
class BackportError extends Error {
|
|
17
|
-
constructor(errorContextOrString) {
|
|
18
|
-
const errorContext = typeof errorContextOrString === 'string'
|
|
19
|
-
? { code: 'message-only-exception', message: errorContextOrString }
|
|
20
|
-
: errorContextOrString;
|
|
21
|
-
const message = getMessage(errorContext);
|
|
22
|
-
super(message);
|
|
23
|
-
Error.captureStackTrace(this, BackportError);
|
|
24
|
-
this.name = 'BackportError';
|
|
25
|
-
this.message = message;
|
|
26
|
-
this.errorContext = errorContext;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.BackportError = BackportError;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
7
|
-
const rest_1 = require("@octokit/rest");
|
|
8
|
-
const getDevAccessToken_1 = require("../../../test/private/getDevAccessToken");
|
|
9
|
-
const createPullRequest_1 = require("../v3/createPullRequest");
|
|
10
|
-
const disablePullRequestAutoMerge_1 = require("./disablePullRequestAutoMerge");
|
|
11
|
-
const enablePullRequestAutoMerge_1 = require("./enablePullRequestAutoMerge");
|
|
12
|
-
const fetchPullRequestAutoMergeMethod_1 = require("./fetchPullRequestAutoMergeMethod");
|
|
13
|
-
// The test repo requires auto-merge being enabled in options, as well as all merge types enabled (merge, squash, rebase)
|
|
14
|
-
// The test pull requests should be open, and not currently able to be merged (e.g. because it requires an approval),
|
|
15
|
-
// otherwise it will be merged when auto-merge is turned on
|
|
16
|
-
const TEST_REPO_OWNER = 'backport-org';
|
|
17
|
-
const TEST_REPO_NAME = 'repo-with-auto-merge-enabled';
|
|
18
|
-
// commit to create new branch from
|
|
19
|
-
// https://github.com/backport-org/repo-with-auto-merge-enabled/commit/1a88d210f90a22e2a06253c5760909833dc820e9
|
|
20
|
-
const COMMIT_SHA = '1a88d210f90a22e2a06253c5760909833dc820e9';
|
|
21
|
-
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
22
|
-
async function closePr(octokit, pullNumber) {
|
|
23
|
-
await octokit.pulls.update({
|
|
24
|
-
owner: TEST_REPO_OWNER,
|
|
25
|
-
repo: TEST_REPO_NAME,
|
|
26
|
-
pull_number: pullNumber,
|
|
27
|
-
state: 'closed',
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
async function createPr(options, branchName) {
|
|
31
|
-
const prPayload = {
|
|
32
|
-
base: 'main',
|
|
33
|
-
head: branchName,
|
|
34
|
-
body: 'testing...',
|
|
35
|
-
owner: TEST_REPO_OWNER,
|
|
36
|
-
repo: TEST_REPO_NAME,
|
|
37
|
-
title: 'my pr title',
|
|
38
|
-
};
|
|
39
|
-
const { number } = await (0, createPullRequest_1.createPullRequest)({ options, prPayload });
|
|
40
|
-
return number;
|
|
41
|
-
}
|
|
42
|
-
async function deleteBranch(octokit, branchName) {
|
|
43
|
-
await octokit.git.deleteRef({
|
|
44
|
-
owner: TEST_REPO_OWNER,
|
|
45
|
-
repo: TEST_REPO_NAME,
|
|
46
|
-
ref: `heads/${branchName}`,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
async function createBranch(octokit, branchName, sha) {
|
|
50
|
-
await octokit.git.createRef({
|
|
51
|
-
owner: TEST_REPO_OWNER,
|
|
52
|
-
repo: TEST_REPO_NAME,
|
|
53
|
-
ref: `refs/heads/${branchName}`,
|
|
54
|
-
sha,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
// causes flaky test runs on CI because parallel builds are racing each other
|
|
58
|
-
// might also be an issue with Github's API being slow at updating after a mutation happens
|
|
59
|
-
// eslint-disable-next-line jest/no-disabled-tests
|
|
60
|
-
describe.skip('enablePullRequestAutoMerge', () => {
|
|
61
|
-
let pullNumber;
|
|
62
|
-
let branchName;
|
|
63
|
-
let octokit;
|
|
64
|
-
let options;
|
|
65
|
-
beforeAll(async () => {
|
|
66
|
-
const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
67
|
-
const randomString = crypto_1.default.randomBytes(4).toString('hex');
|
|
68
|
-
branchName = `test-${randomString}`;
|
|
69
|
-
options = {
|
|
70
|
-
accessToken,
|
|
71
|
-
repoOwner: TEST_REPO_OWNER,
|
|
72
|
-
repoName: TEST_REPO_NAME,
|
|
73
|
-
};
|
|
74
|
-
octokit = new rest_1.Octokit({ auth: accessToken });
|
|
75
|
-
await createBranch(octokit, branchName, COMMIT_SHA);
|
|
76
|
-
pullNumber = await createPr(options, branchName);
|
|
77
|
-
});
|
|
78
|
-
// cleanup
|
|
79
|
-
afterAll(async () => {
|
|
80
|
-
await closePr(octokit, pullNumber);
|
|
81
|
-
await deleteBranch(octokit, branchName);
|
|
82
|
-
});
|
|
83
|
-
// reset auto-merge state between runs
|
|
84
|
-
afterEach(async () => {
|
|
85
|
-
await (0, disablePullRequestAutoMerge_1.disablePullRequestAutoMerge)(options, pullNumber);
|
|
86
|
-
});
|
|
87
|
-
it('should initially have auto-merge disabled', async () => {
|
|
88
|
-
const autoMergeMethod = await (0, fetchPullRequestAutoMergeMethod_1.fetchPullRequestAutoMergeMethod)(options, pullNumber);
|
|
89
|
-
expect(autoMergeMethod).toBe(undefined);
|
|
90
|
-
});
|
|
91
|
-
it('should enable auto-merge via merge', async () => {
|
|
92
|
-
await (0, enablePullRequestAutoMerge_1.enablePullRequestAutoMerge)({ ...options, autoMergeMethod: 'merge' }, pullNumber);
|
|
93
|
-
// ensure Github API reflects the change before querying
|
|
94
|
-
await sleep(100);
|
|
95
|
-
const autoMergeMethod = await (0, fetchPullRequestAutoMergeMethod_1.fetchPullRequestAutoMergeMethod)(options, pullNumber);
|
|
96
|
-
expect(autoMergeMethod).toBe('MERGE');
|
|
97
|
-
});
|
|
98
|
-
it('should not enable auto-merge via rebase because it is disallowed', async () => {
|
|
99
|
-
await (0, enablePullRequestAutoMerge_1.enablePullRequestAutoMerge)({ ...options, autoMergeMethod: 'rebase' }, pullNumber);
|
|
100
|
-
// ensure Github API reflects the change before querying
|
|
101
|
-
await sleep(100);
|
|
102
|
-
const autoMergeMethod = await (0, fetchPullRequestAutoMergeMethod_1.fetchPullRequestAutoMergeMethod)(options, pullNumber);
|
|
103
|
-
expect(autoMergeMethod).toBe(undefined);
|
|
104
|
-
});
|
|
105
|
-
it('should enable auto-merge via squash', async () => {
|
|
106
|
-
await (0, enablePullRequestAutoMerge_1.enablePullRequestAutoMerge)({ ...options, autoMergeMethod: 'squash' }, pullNumber);
|
|
107
|
-
// ensure Github API reflects the change before querying
|
|
108
|
-
await sleep(100);
|
|
109
|
-
const autoMergeMethod = await (0, fetchPullRequestAutoMergeMethod_1.fetchPullRequestAutoMergeMethod)(options, pullNumber);
|
|
110
|
-
expect(autoMergeMethod).toBe('SQUASH');
|
|
111
|
-
});
|
|
112
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|