backport 6.1.5 → 6.3.0-beta-2
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 +15 -6
- package/dist/{main.d.ts → backportRun.d.ts} +3 -3
- package/dist/{main.js → backportRun.js} +21 -10
- package/dist/{entrypoint.module.private.test.d.ts → entrypoint.cli.e2e.private.test.d.ts} +0 -0
- package/dist/entrypoint.cli.e2e.private.test.js +277 -0
- package/dist/entrypoint.cli.js +3 -5
- package/dist/{options/getValidatedOptions.test.d.ts → entrypoint.cli.private.test.d.ts} +0 -0
- package/dist/{entrypoint.module.private.test.js → entrypoint.cli.private.test.js} +17 -8
- package/dist/entrypoint.module.d.ts +2 -2
- package/dist/entrypoint.module.js +4 -4
- package/dist/options/ConfigOptions.d.ts +5 -1
- package/dist/options/cliArgs.d.ts +16 -14
- package/dist/options/cliArgs.js +15 -5
- package/dist/options/cliArgs.test.js +28 -10
- package/dist/options/config/config.d.ts +10 -4
- package/dist/options/config/config.js +7 -6
- package/dist/options/config/config.test.js +11 -1
- package/dist/options/config/globalConfig.d.ts +1 -1
- package/dist/options/config/globalConfig.js +15 -9
- package/dist/options/config/globalConfig.test.js +19 -32
- package/dist/options/config/projectConfig.d.ts +3 -1
- package/dist/options/config/projectConfig.js +5 -2
- package/dist/options/config/projectConfig.test.js +41 -31
- package/dist/options/config/readConfigFile.d.ts +27 -23
- package/dist/options/config/readConfigFile.js +2 -2
- package/dist/options/options.d.ts +18 -39
- package/dist/options/options.js +40 -32
- package/dist/options/options.test.js +83 -47
- package/dist/runSequentially.d.ts +0 -1
- package/dist/runSequentially.js +0 -1
- package/dist/runSequentially.test.js +39 -20
- package/dist/scripts/postinstall.js +3 -3
- package/dist/services/HandledError.d.ts +6 -4
- package/dist/services/HandledError.js +18 -3
- package/dist/services/child-process-promisified.d.ts +3 -1
- package/dist/services/env.d.ts +3 -1
- package/dist/services/env.js +4 -1
- package/dist/services/env.test.js +2 -2
- package/dist/services/git.d.ts +22 -9
- package/dist/services/git.integration.test.js +123 -24
- package/dist/services/git.js +66 -54
- package/dist/services/git.test.js +35 -20
- package/dist/services/github/commitFormatters.d.ts +0 -1
- package/dist/services/github/commitFormatters.js +1 -8
- package/dist/services/github/v3/createPullRequest.js +16 -10
- package/dist/services/github/v3/createPullRequest.test.js +248 -33
- package/dist/services/github/v3/createStatusComment.d.ts +1 -1
- package/dist/services/github/v3/createStatusComment.js +26 -15
- package/dist/services/github/v3/createStatusComment.test.js +165 -70
- package/dist/services/github/v3/getGithubV3ErrorMessage.d.ts +2 -1
- package/dist/services/github/v4/FetchPullRequestId.d.ts +0 -7
- package/dist/services/github/v4/apiRequestV4.d.ts +21 -17
- package/dist/services/github/v4/apiRequestV4.js +38 -28
- package/dist/services/github/v4/apiRequestV4.test.js +4 -4
- package/dist/services/github/v4/disablePullRequestAutoMerge.d.ts +0 -7
- package/dist/services/github/v4/enablePullRequestAutoMerge.d.ts +0 -7
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +37 -19
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +17 -8
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +23 -14
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +2 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +4 -4
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +41 -19
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +1 -8
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +31 -14
- package/dist/services/github/v4/fetchExistingPullRequest.d.ts +0 -4
- package/dist/services/github/v4/fetchExistingPullRequest.js +1 -2
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +0 -9
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +6 -2
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +41 -34
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +6 -0
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +2 -1
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +29 -0
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.js +56 -0
- package/dist/{options/parseRequiredOptions.test.d.ts → services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.d.ts} +0 -0
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +71 -0
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +11 -11
- package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +4 -5
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -7
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +5 -5
- package/dist/services/logger.d.ts +9 -3
- package/dist/services/logger.js +38 -35
- package/dist/services/prompt.test.js +66 -19
- package/dist/services/prompts.js +12 -10
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +1 -1
- package/dist/services/sourceCommit/getMockSourceCommit.js +6 -6
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +18 -10
- package/dist/services/sourceCommit/parseSourceCommit.js +20 -14
- package/dist/services/sourceCommit/parseSourceCommit.test.js +18 -20
- package/dist/{runWithOptions.test.d.ts → test/backport-e2e.mutation.test.d.ts} +0 -0
- package/dist/test/{integration/integration.private.test.js → backport-e2e.mutation.test.js} +143 -123
- package/dist/{scripts/generate-gql.d.ts → test/handleUnbackportedPullRequests.private.test.d.ts} +0 -0
- package/dist/test/handleUnbackportedPullRequests.private.test.js +57 -0
- package/dist/test/mockConfigFiles.js +4 -20
- package/dist/test/mocks.d.ts +10 -0
- package/dist/test/mocks.js +23 -0
- package/dist/test/private/getDevAccessToken.js +5 -4
- package/dist/test/sandbox.d.ts +5 -0
- package/dist/test/sandbox.js +43 -0
- package/dist/test/setupFiles/automatic-mocks.d.ts +1 -0
- package/dist/test/setupFiles/automatic-mocks.js +27 -11
- package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +0 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +12 -13
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +50 -27
- package/dist/ui/getCommits.js +8 -14
- package/dist/ui/getCommitsWithoutBackports.js +6 -6
- package/dist/ui/getCommitsWithoutBackports.test.js +91 -39
- package/dist/ui/getTargetBranches.js +1 -1
- package/dist/ui/getTargetBranches.test.js +26 -8
- package/dist/ui/maybeSetupRepo.js +25 -5
- package/dist/ui/maybeSetupRepo.test.js +144 -14
- package/dist/utils/maybe.d.ts +1 -0
- package/dist/utils/maybe.js +7 -0
- package/dist/utils/packageVersion.d.ts +1 -0
- package/dist/{types/PromiseReturnType.js → utils/packageVersion.js} +2 -0
- package/package.json +24 -20
- package/yarn.lock +160 -237
- package/dist/index.d.ts +0 -783
- package/dist/index.js +0 -8001
- package/dist/ink.d.ts +0 -1
- package/dist/ink.js +0 -49
- package/dist/options/config/getOptionsFromGit.d.ts +0 -4
- package/dist/options/config/getOptionsFromGit.js +0 -8
- package/dist/options/getValidatedOptions.d.ts +0 -49
- package/dist/options/getValidatedOptions.js +0 -45
- package/dist/options/getValidatedOptions.test.js +0 -97
- package/dist/options/parseRequiredOptions.d.ts +0 -71
- package/dist/options/parseRequiredOptions.js +0 -68
- package/dist/options/parseRequiredOptions.test.js +0 -122
- package/dist/runWithOptions.d.ts +0 -9
- package/dist/runWithOptions.js +0 -43
- package/dist/runWithOptions.test.js +0 -304
- package/dist/scripts/generate-gql.js +0 -15
- package/dist/services/fs-promisified.d.ts +0 -6
- package/dist/services/fs-promisified.js +0 -12
- package/dist/services/getExpectedTarget.d.ts +0 -9
- package/dist/services/getExpectedTarget.js +0 -77
- package/dist/services/getExpectedTargetPullRequests.d.ts +0 -9
- package/dist/services/getExpectedTargetPullRequests.js +0 -77
- package/dist/services/github/v4/fetchCommitByPullNumber.d.ts +0 -5
- package/dist/services/github/v4/fetchCommitByPullNumber.js +0 -86
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +0 -57
- package/dist/services/github/v4/fetchCommitBySha.d.ts +0 -5
- package/dist/services/github/v4/fetchCommitBySha.js +0 -95
- package/dist/services/github/v4/fetchCommitBySha.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitBySha.private.test.js +0 -50
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +0 -28
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +0 -52
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.d.ts +0 -3
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.js +0 -55
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +0 -252
- package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +0 -28
- package/dist/services/github/v4/fetchCommitsByAuthor.js +0 -161
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +0 -115
- package/dist/services/github/v4/fetchCommitsByAuthor.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitsByAuthor.test.js +0 -272
- package/dist/services/github/v4/fetchDefaultBranch.d.ts +0 -9
- package/dist/services/github/v4/fetchDefaultBranch.js +0 -24
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -4
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -52
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.d.ts +0 -4
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.js +0 -72
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.js +0 -34
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.d.ts +0 -40
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.js +0 -72
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -17
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -69
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
- package/dist/services/github/v4/fetchMergedPullRequests.d.ts +0 -37
- package/dist/services/github/v4/fetchMergedPullRequests.js +0 -37
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +0 -59
- package/dist/services/github/v4/fetchMergedPullRequests.test.d.ts +0 -1
- package/dist/services/github/v4/fetchMergedPullRequests.test.js +0 -22
- package/dist/services/github/v4/fetchProjectConfig.d.ts +0 -8
- package/dist/services/github/v4/fetchProjectConfig.js +0 -56
- package/dist/services/github/v4/fetchProjectConfig.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchProjectConfig.private.test.js +0 -52
- package/dist/services/github/v4/fetchProjectConfig.test.d.ts +0 -1
- package/dist/services/github/v4/fetchProjectConfig.test.js +0 -37
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.d.ts +0 -9
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +0 -92
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +0 -66
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.d.ts +0 -1
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +0 -242
- package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +0 -7
- package/dist/services/github/v4/getExistingTargetPullRequests.js +0 -45
- package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +0 -63
- package/dist/services/github/v4/getOptionsFromGithub/index.js +0 -139
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.d.ts +0 -1
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +0 -147
- package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -5
- package/dist/services/github/v4/getTargetBranchesFromLabels.js +0 -20
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +0 -201
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +0 -843
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +0 -73
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +0 -12
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +0 -44
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +0 -5
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +0 -20
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +0 -201
- package/dist/services/sourceCommit/sourceCommit.d.ts +0 -78
- package/dist/services/sourceCommit/sourceCommit.js +0 -86
- package/dist/services/sourceCommit/sourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit/sourceCommit.test.js +0 -287
- package/dist/services/sourceCommit.d.ts +0 -78
- package/dist/services/sourceCommit.js +0 -86
- package/dist/services/sourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit.test.js +0 -280
- package/dist/test/inquirer.private.test.d.ts +0 -1
- package/dist/test/inquirer.private.test.js +0 -168
- package/dist/test/integration/createSpies.d.ts +0 -17
- package/dist/test/integration/createSpies.js +0 -85
- package/dist/test/integration/envConstants.d.ts +0 -5
- package/dist/test/integration/envConstants.js +0 -9
- package/dist/test/integration/helpers.d.ts +0 -7
- package/dist/test/integration/helpers.js +0 -31
- package/dist/test/integration/integration.private.test.d.ts +0 -1
- package/dist/test/integration/integration.test.d.ts +0 -1
- package/dist/test/integration/integration.test.js +0 -214
- package/dist/todo-delete.d.ts +0 -1
- package/dist/todo-delete.js +0 -17
- package/dist/types/Commit.d.ts +0 -85
- package/dist/types/Commit.js +0 -139
- package/dist/types/PromiseReturnType.d.ts +0 -1
- package/dist/types/commitNode.d.ts +0 -89
- package/dist/types/commitNode.js +0 -139
- package/dist/types/commitNode.test.d.ts +0 -1
- package/dist/types/commitNode.test.js +0 -255
- package/dist/types/commitWithAssociatedPullRequests.d.ts +0 -86
- package/dist/types/commitWithAssociatedPullRequests.js +0 -145
- package/dist/ui/cherrypickAndCreatePullRequest.test.d.ts +0 -1
- package/dist/ui/cherrypickAndCreatePullRequest.test.js +0 -617
- package/dist/ui/getTargetBranchesFromLabels.d.ts +0 -6
- package/dist/ui/getTargetBranchesFromLabels.js +0 -40
- package/dist/ui/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/ui/getTargetBranchesFromLabels.test.js +0 -288
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const getDevAccessToken_1 = require("../../../test/private/getDevAccessToken");
|
|
4
|
-
const fetchRemoteProjectConfig_1 = require("./fetchRemoteProjectConfig");
|
|
5
|
-
describe('fetchRemoteProjectConfig', () => {
|
|
6
|
-
let devAccessToken;
|
|
7
|
-
beforeEach(async () => {
|
|
8
|
-
devAccessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
|
-
});
|
|
10
|
-
it('returns the backport config from "main" branch', async () => {
|
|
11
|
-
const projectConfig = await (0, fetchRemoteProjectConfig_1.fetchRemoteProjectConfig)({
|
|
12
|
-
repoOwner: 'backport-org',
|
|
13
|
-
repoName: 'repo-with-project-config',
|
|
14
|
-
accessToken: devAccessToken,
|
|
15
|
-
sourceBranch: 'main',
|
|
16
|
-
});
|
|
17
|
-
expect(projectConfig).toEqual({
|
|
18
|
-
autoMerge: true,
|
|
19
|
-
autoMergeMethod: 'squash',
|
|
20
|
-
branchLabelMapping: {
|
|
21
|
-
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
22
|
-
'^v8.1.0$': 'main',
|
|
23
|
-
},
|
|
24
|
-
targetBranchChoices: ['main', '8.0', '7.17', '7.16'],
|
|
25
|
-
targetPRLabels: ['backport'],
|
|
26
|
-
repoOwner: 'backport-org',
|
|
27
|
-
repoName: 'repo-with-project-config',
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
it('returns the backport config from "branch-with-legacy-config" branch', async () => {
|
|
31
|
-
const projectConfig = await (0, fetchRemoteProjectConfig_1.fetchRemoteProjectConfig)({
|
|
32
|
-
repoOwner: 'backport-org',
|
|
33
|
-
repoName: 'repo-with-project-config',
|
|
34
|
-
accessToken: devAccessToken,
|
|
35
|
-
sourceBranch: 'branch-with-legacy-config',
|
|
36
|
-
});
|
|
37
|
-
expect(projectConfig).toEqual({
|
|
38
|
-
targetBranchChoices: ['main', '8.0', '7.17', '7.16'],
|
|
39
|
-
repoOwner: 'backport-org',
|
|
40
|
-
repoName: 'repo-with-project-config',
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
it('throws an error if config does not exist', async () => {
|
|
44
|
-
const promise = (0, fetchRemoteProjectConfig_1.fetchRemoteProjectConfig)({
|
|
45
|
-
repoOwner: 'backport-org',
|
|
46
|
-
repoName: 'repo-with-project-config',
|
|
47
|
-
accessToken: devAccessToken,
|
|
48
|
-
sourceBranch: 'branch-with-no-config',
|
|
49
|
-
});
|
|
50
|
-
await expect(promise).rejects.toThrowError('Project config does not exist');
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const getDevAccessToken_1 = require("../../../test/private/getDevAccessToken");
|
|
4
|
-
const fetchProjectConfig_1 = require("./fetchProjectConfig");
|
|
5
|
-
describe('fetchProjectConfig', () => {
|
|
6
|
-
let devAccessToken;
|
|
7
|
-
beforeEach(async () => {
|
|
8
|
-
devAccessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
|
-
});
|
|
10
|
-
it('returns the backport config from "main" branch', async () => {
|
|
11
|
-
const projectConfig = await (0, fetchProjectConfig_1.fetchProjectConfig)({
|
|
12
|
-
repoOwner: 'backport-org',
|
|
13
|
-
repoName: 'repo-with-project-config',
|
|
14
|
-
accessToken: devAccessToken,
|
|
15
|
-
sourceBranch: 'main',
|
|
16
|
-
});
|
|
17
|
-
expect(projectConfig).toEqual();
|
|
18
|
-
});
|
|
19
|
-
it('returns the backport config from "branch-with-minimal-config" branch', async () => {
|
|
20
|
-
const projectConfig = await (0, fetchProjectConfig_1.fetchProjectConfig)({
|
|
21
|
-
repoOwner: 'backport-org',
|
|
22
|
-
repoName: 'repo-with-project-config',
|
|
23
|
-
accessToken: devAccessToken,
|
|
24
|
-
sourceBranch: 'branch-with-minimal-config',
|
|
25
|
-
});
|
|
26
|
-
expect(projectConfig).toEqual();
|
|
27
|
-
});
|
|
28
|
-
it('throws an error if config does not exist', async () => {
|
|
29
|
-
const promise = (0, fetchProjectConfig_1.fetchProjectConfig)({
|
|
30
|
-
repoOwner: 'backport-org',
|
|
31
|
-
repoName: 'repo-with-project-config',
|
|
32
|
-
accessToken: devAccessToken,
|
|
33
|
-
sourceBranch: 'branch-with-no-config',
|
|
34
|
-
});
|
|
35
|
-
await expect(promise).rejects.toThrowError('something...');
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ValidConfigOptions } from '../../../options/options';
|
|
2
|
-
import { Commit } from '../../../types/Commit';
|
|
3
|
-
import { PullRequestNode } from './getExistingTargetPullRequests';
|
|
4
|
-
export declare function fetchPullRequestBySearchQuery(options: ValidConfigOptions): Promise<Commit[]>;
|
|
5
|
-
export interface PullRequestBySearchQueryResponse {
|
|
6
|
-
search: {
|
|
7
|
-
nodes: PullRequestNode[];
|
|
8
|
-
};
|
|
9
|
-
}
|
|
@@ -1,92 +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
|
-
exports.fetchPullRequestBySearchQuery = void 0;
|
|
7
|
-
const lodash_1 = require("lodash");
|
|
8
|
-
const ora_1 = __importDefault(require("ora"));
|
|
9
|
-
const HandledError_1 = require("../../HandledError");
|
|
10
|
-
const commitFormatters_1 = require("../commitFormatters");
|
|
11
|
-
const apiRequestV4_1 = require("./apiRequestV4");
|
|
12
|
-
const getExistingTargetPullRequests_1 = require("./getExistingTargetPullRequests");
|
|
13
|
-
const getTargetBranchesFromLabels_1 = require("./getTargetBranchesFromLabels");
|
|
14
|
-
async function fetchPullRequestBySearchQuery(options) {
|
|
15
|
-
const { accessToken, all, author, githubApiBaseUrlV4, maxNumber, prFilter, repoName, repoOwner, sourceBranch, } = options;
|
|
16
|
-
const query = /* GraphQL */ `
|
|
17
|
-
query PullRequestBySearchQuery($query: String!, $maxNumber: Int!) {
|
|
18
|
-
search(query: $query, type: ISSUE, first: $maxNumber) {
|
|
19
|
-
nodes {
|
|
20
|
-
... on PullRequest {
|
|
21
|
-
...${getExistingTargetPullRequests_1.pullRequestFragment.name}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
${getExistingTargetPullRequests_1.pullRequestFragment.source}
|
|
28
|
-
`;
|
|
29
|
-
const authorFilter = all ? '' : `author:${author}`;
|
|
30
|
-
const searchQuery = `type:pr is:merged sort:updated-desc repo:${repoOwner}/${repoName} ${authorFilter} ${prFilter} base:${sourceBranch}`;
|
|
31
|
-
const spinner = (0, ora_1.default)('Loading pull requests...').start();
|
|
32
|
-
let res;
|
|
33
|
-
try {
|
|
34
|
-
res = await (0, apiRequestV4_1.apiRequestV4)({
|
|
35
|
-
githubApiBaseUrlV4,
|
|
36
|
-
accessToken,
|
|
37
|
-
query,
|
|
38
|
-
variables: {
|
|
39
|
-
query: searchQuery,
|
|
40
|
-
maxNumber: maxNumber,
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
spinner.stop();
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
spinner.fail();
|
|
47
|
-
throw e;
|
|
48
|
-
}
|
|
49
|
-
const commits = res.search.nodes.map((pullRequestNode) => {
|
|
50
|
-
// this should never happen since we are searching for merged PR (is:merged) in the first place
|
|
51
|
-
// but typescript doesn't know about this
|
|
52
|
-
if (pullRequestNode.mergeCommit == null) {
|
|
53
|
-
throw new Error('Pull Request is not merged');
|
|
54
|
-
}
|
|
55
|
-
const committedDate = pullRequestNode.mergeCommit.committedDate;
|
|
56
|
-
const sha = pullRequestNode.mergeCommit.oid;
|
|
57
|
-
const pullNumber = pullRequestNode.number;
|
|
58
|
-
const commitMessage = pullRequestNode.mergeCommit.message;
|
|
59
|
-
const formattedMessage = (0, commitFormatters_1.getFormattedCommitMessage)({
|
|
60
|
-
message: commitMessage,
|
|
61
|
-
sha,
|
|
62
|
-
pullNumber,
|
|
63
|
-
});
|
|
64
|
-
const existingTargetPullRequests = (0, getExistingTargetPullRequests_1.getExistingTargetPullRequests)(pullRequestNode);
|
|
65
|
-
const targetBranchesFromLabels = (0, getTargetBranchesFromLabels_1.getTargetBranchesFromLabels)({
|
|
66
|
-
sourceBranch: pullRequestNode.baseRefName,
|
|
67
|
-
existingTargetPullRequests,
|
|
68
|
-
branchLabelMapping: options.branchLabelMapping,
|
|
69
|
-
labels: (0, getExistingTargetPullRequests_1.getPullRequestLabels)(pullRequestNode),
|
|
70
|
-
});
|
|
71
|
-
const choice = {
|
|
72
|
-
committedDate,
|
|
73
|
-
sourceBranch,
|
|
74
|
-
targetBranchesFromLabels,
|
|
75
|
-
sha,
|
|
76
|
-
formattedMessage,
|
|
77
|
-
originalMessage: commitMessage,
|
|
78
|
-
pullNumber,
|
|
79
|
-
existingTargetPullRequests,
|
|
80
|
-
};
|
|
81
|
-
return choice;
|
|
82
|
-
});
|
|
83
|
-
// terminate if not commits were found
|
|
84
|
-
if ((0, lodash_1.isEmpty)(commits)) {
|
|
85
|
-
const errorText = options.all
|
|
86
|
-
? `There are no pull requests matching the filter "${prFilter}"`
|
|
87
|
-
: `There are no commits by "${options.author}" matching the filter "${prFilter}". Try with \`--all\` for commits by all users or \`--author=<username>\` for commits from a specific user`;
|
|
88
|
-
throw new HandledError_1.HandledError(errorText);
|
|
89
|
-
}
|
|
90
|
-
return commits;
|
|
91
|
-
}
|
|
92
|
-
exports.fetchPullRequestBySearchQuery = fetchPullRequestBySearchQuery;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const getDevAccessToken_1 = require("../../../test/private/getDevAccessToken");
|
|
4
|
-
const fetchPullRequestBySearchQuery_1 = require("./fetchPullRequestBySearchQuery");
|
|
5
|
-
describe('fetchPullRequestBySearchQuery', () => {
|
|
6
|
-
let devAccessToken;
|
|
7
|
-
beforeAll(async () => {
|
|
8
|
-
devAccessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
|
-
});
|
|
10
|
-
describe('when filter does not match any PRs', () => {
|
|
11
|
-
it('throws an error', async () => {
|
|
12
|
-
const options = {
|
|
13
|
-
accessToken: devAccessToken,
|
|
14
|
-
all: false,
|
|
15
|
-
author: 'sqren',
|
|
16
|
-
githubApiBaseUrlV4: 'https://api.github.com/graphql',
|
|
17
|
-
maxNumber: 10,
|
|
18
|
-
prFilter: 'label:non-existing',
|
|
19
|
-
repoName: 'backport-e2e',
|
|
20
|
-
repoOwner: 'backport-org',
|
|
21
|
-
sourceBranch: 'master',
|
|
22
|
-
};
|
|
23
|
-
await expect((0, fetchPullRequestBySearchQuery_1.fetchPullRequestBySearchQuery)(options)).rejects.toThrowError('There are no commits by "sqren" matching the filter "label:non-existing". Try with `--all` for commits by all users or `--author=<username>` for commits from a specific user');
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
describe('when filter matches PRs', () => {
|
|
27
|
-
it('returns the merge commits for those PRs', async () => {
|
|
28
|
-
const options = {
|
|
29
|
-
accessToken: devAccessToken,
|
|
30
|
-
all: false,
|
|
31
|
-
author: 'sqren',
|
|
32
|
-
githubApiBaseUrlV4: 'https://api.github.com/graphql',
|
|
33
|
-
maxNumber: 10,
|
|
34
|
-
prFilter: 'label:v7.8.0',
|
|
35
|
-
repoName: 'backport-e2e',
|
|
36
|
-
repoOwner: 'backport-org',
|
|
37
|
-
sourceBranch: 'master',
|
|
38
|
-
};
|
|
39
|
-
expect(await (0, fetchPullRequestBySearchQuery_1.fetchPullRequestBySearchQuery)(options)).toEqual([
|
|
40
|
-
{
|
|
41
|
-
existingTargetPullRequests: [
|
|
42
|
-
{ branch: '7.8', state: 'OPEN', number: 10 },
|
|
43
|
-
],
|
|
44
|
-
formattedMessage: 'Add sheep emoji (#9)',
|
|
45
|
-
originalMessage: 'Add sheep emoji (#9)',
|
|
46
|
-
pullNumber: 9,
|
|
47
|
-
sha: 'eebf165c82a4b718d95c11b3877e365b1949ff28',
|
|
48
|
-
sourceBranch: 'master',
|
|
49
|
-
targetBranchesFromLabels: [],
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
existingTargetPullRequests: [
|
|
53
|
-
{ branch: '7.x', state: 'MERGED', number: 6 },
|
|
54
|
-
{ branch: '7.8', state: 'MERGED', number: 7 },
|
|
55
|
-
],
|
|
56
|
-
formattedMessage: 'Add 🍏 emoji (#5)',
|
|
57
|
-
originalMessage: 'Add 🍏 emoji (#5)',
|
|
58
|
-
pullNumber: 5,
|
|
59
|
-
sha: 'ee8c492334cef1ca077a56addb79a26f79821d2f',
|
|
60
|
-
sourceBranch: 'master',
|
|
61
|
-
targetBranchesFromLabels: [],
|
|
62
|
-
},
|
|
63
|
-
]);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,242 +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 nock_1 = __importDefault(require("nock"));
|
|
7
|
-
const nockHelpers_1 = require("../../../test/nockHelpers");
|
|
8
|
-
const fetchPullRequestBySearchQuery_1 = require("./fetchPullRequestBySearchQuery");
|
|
9
|
-
const fetchPullRequestBySearchQueryMock_1 = require("./mocks/fetchPullRequestBySearchQueryMock");
|
|
10
|
-
describe('fetchPullRequestBySearchQuery', () => {
|
|
11
|
-
let res;
|
|
12
|
-
let mockCalls;
|
|
13
|
-
beforeEach(async () => {
|
|
14
|
-
mockCalls = (0, nockHelpers_1.mockGqlRequest)({
|
|
15
|
-
name: 'PullRequestBySearchQuery',
|
|
16
|
-
statusCode: 200,
|
|
17
|
-
body: { data: fetchPullRequestBySearchQueryMock_1.fetchPullRequestBySearchQueryMock },
|
|
18
|
-
});
|
|
19
|
-
res = await (0, fetchPullRequestBySearchQuery_1.fetchPullRequestBySearchQuery)({
|
|
20
|
-
accessToken: 'myAccessToken',
|
|
21
|
-
all: false,
|
|
22
|
-
author: 'sqren',
|
|
23
|
-
githubApiBaseUrlV4: 'http://localhost/graphql',
|
|
24
|
-
maxNumber: 10,
|
|
25
|
-
repoName: 'kibana',
|
|
26
|
-
repoOwner: 'elastic',
|
|
27
|
-
sourceBranch: 'master',
|
|
28
|
-
prFilter: 'label:Team:apm',
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
afterEach(() => {
|
|
32
|
-
nock_1.default.cleanAll();
|
|
33
|
-
});
|
|
34
|
-
it('should make request with correct variables', () => {
|
|
35
|
-
expect(mockCalls.length).toBe(1);
|
|
36
|
-
expect(mockCalls[0].variables).toEqual({
|
|
37
|
-
maxNumber: 10,
|
|
38
|
-
query: 'type:pr is:merged sort:updated-desc repo:elastic/kibana author:sqren label:Team:apm base:master',
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
it('should return correct response', async () => {
|
|
42
|
-
expect(res).toMatchInlineSnapshot(`
|
|
43
|
-
Array [
|
|
44
|
-
Object {
|
|
45
|
-
"existingTargetPullRequests": Array [
|
|
46
|
-
Object {
|
|
47
|
-
"branch": "7.x",
|
|
48
|
-
"number": 99,
|
|
49
|
-
"state": "MERGED",
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
"formattedMessage": "[APM] @ts-error -> @ts-expect-error (#76492)",
|
|
53
|
-
"originalMessage": "[APM] @ts-error -> @ts-expect-error (#76492)
|
|
54
|
-
|
|
55
|
-
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>",
|
|
56
|
-
"pullNumber": 76492,
|
|
57
|
-
"sha": "e0f4775b780aada005bdd1774edcceac0ffee006",
|
|
58
|
-
"sourceBranch": "master",
|
|
59
|
-
"targetBranchesFromLabels": Array [],
|
|
60
|
-
},
|
|
61
|
-
Object {
|
|
62
|
-
"existingTargetPullRequests": Array [
|
|
63
|
-
Object {
|
|
64
|
-
"branch": "7.x",
|
|
65
|
-
"number": 99,
|
|
66
|
-
"state": "MERGED",
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
"formattedMessage": "[APM] Avoid negative offset for error marker on timeline (#76638)",
|
|
70
|
-
"originalMessage": "[APM] Avoid negative offset for error marker on timeline (#76638)
|
|
71
|
-
|
|
72
|
-
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>",
|
|
73
|
-
"pullNumber": 76638,
|
|
74
|
-
"sha": "fae1e02e0f7a475bf92da05be52a817aa2a84959",
|
|
75
|
-
"sourceBranch": "master",
|
|
76
|
-
"targetBranchesFromLabels": Array [],
|
|
77
|
-
},
|
|
78
|
-
Object {
|
|
79
|
-
"existingTargetPullRequests": Array [
|
|
80
|
-
Object {
|
|
81
|
-
"branch": "7.x",
|
|
82
|
-
"number": 99,
|
|
83
|
-
"state": "MERGED",
|
|
84
|
-
},
|
|
85
|
-
Object {
|
|
86
|
-
"branch": "7.9",
|
|
87
|
-
"number": 99,
|
|
88
|
-
"state": "MERGED",
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
"formattedMessage": "[APM] Add anomaly detection API tests + fixes (#73120)",
|
|
92
|
-
"originalMessage": "[APM] Add anomaly detection API tests + fixes (#73120)
|
|
93
|
-
|
|
94
|
-
Co-authored-by: Nathan L Smith <nathan.smith@elastic.co>",
|
|
95
|
-
"pullNumber": 73120,
|
|
96
|
-
"sha": "aa68e3b63a4b513294dc58eaf4422e66a0beffb1",
|
|
97
|
-
"sourceBranch": "master",
|
|
98
|
-
"targetBranchesFromLabels": Array [],
|
|
99
|
-
},
|
|
100
|
-
Object {
|
|
101
|
-
"existingTargetPullRequests": Array [],
|
|
102
|
-
"formattedMessage": "[APM] Update script with new roles/users (#72599)",
|
|
103
|
-
"originalMessage": "[APM] Update script with new roles/users (#72599)
|
|
104
|
-
|
|
105
|
-
* [APM] Update script with new roles/users
|
|
106
|
-
|
|
107
|
-
* add log
|
|
108
|
-
|
|
109
|
-
* Add validation for http prefix",
|
|
110
|
-
"pullNumber": 72599,
|
|
111
|
-
"sha": "2fc7112ec27a9f8ded0e2f9e097613721f1179dd",
|
|
112
|
-
"sourceBranch": "master",
|
|
113
|
-
"targetBranchesFromLabels": Array [],
|
|
114
|
-
},
|
|
115
|
-
Object {
|
|
116
|
-
"existingTargetPullRequests": Array [
|
|
117
|
-
Object {
|
|
118
|
-
"branch": "7.x",
|
|
119
|
-
"number": 99,
|
|
120
|
-
"state": "MERGED",
|
|
121
|
-
},
|
|
122
|
-
Object {
|
|
123
|
-
"branch": "7.9",
|
|
124
|
-
"number": 99,
|
|
125
|
-
"state": "MERGED",
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
"formattedMessage": "Update jobs_list.tsx (#72797)",
|
|
129
|
-
"originalMessage": "Update jobs_list.tsx (#72797)",
|
|
130
|
-
"pullNumber": 72797,
|
|
131
|
-
"sha": "7e126bfab6a3bfc44f9fa50feecfe22b4634e1a0",
|
|
132
|
-
"sourceBranch": "master",
|
|
133
|
-
"targetBranchesFromLabels": Array [],
|
|
134
|
-
},
|
|
135
|
-
Object {
|
|
136
|
-
"existingTargetPullRequests": Array [
|
|
137
|
-
Object {
|
|
138
|
-
"branch": "7.x",
|
|
139
|
-
"number": 99,
|
|
140
|
-
"state": "MERGED",
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
"formattedMessage": "[APM] Fix confusing request/minute viz (#69143)",
|
|
144
|
-
"originalMessage": "[APM] Fix confusing request/minute viz (#69143)",
|
|
145
|
-
"pullNumber": 69143,
|
|
146
|
-
"sha": "d12208c7ea9513529ea1aff42d154db89e3573ff",
|
|
147
|
-
"sourceBranch": "master",
|
|
148
|
-
"targetBranchesFromLabels": Array [],
|
|
149
|
-
},
|
|
150
|
-
Object {
|
|
151
|
-
"existingTargetPullRequests": Array [
|
|
152
|
-
Object {
|
|
153
|
-
"branch": "7.x",
|
|
154
|
-
"number": 99,
|
|
155
|
-
"state": "MERGED",
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
"formattedMessage": "[APM] Remove watcher integration (#71655)",
|
|
159
|
-
"originalMessage": "[APM] Remove watcher integration (#71655)",
|
|
160
|
-
"pullNumber": 71655,
|
|
161
|
-
"sha": "f760d8513b0216a73e9a476661f0fb8fb0887a61",
|
|
162
|
-
"sourceBranch": "master",
|
|
163
|
-
"targetBranchesFromLabels": Array [],
|
|
164
|
-
},
|
|
165
|
-
Object {
|
|
166
|
-
"existingTargetPullRequests": Array [
|
|
167
|
-
Object {
|
|
168
|
-
"branch": "7.x",
|
|
169
|
-
"number": 99,
|
|
170
|
-
"state": "MERGED",
|
|
171
|
-
},
|
|
172
|
-
Object {
|
|
173
|
-
"branch": "7.9",
|
|
174
|
-
"number": 99,
|
|
175
|
-
"state": "MERGED",
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
"formattedMessage": "[APM] Disable flaky rum e2e’s (#72614)",
|
|
179
|
-
"originalMessage": "[APM] Disable flaky rum e2e’s (#72614)",
|
|
180
|
-
"pullNumber": 72614,
|
|
181
|
-
"sha": "05ee3da80db34ccf93e7424aa2704c098a1b49fa",
|
|
182
|
-
"sourceBranch": "master",
|
|
183
|
-
"targetBranchesFromLabels": Array [],
|
|
184
|
-
},
|
|
185
|
-
Object {
|
|
186
|
-
"existingTargetPullRequests": Array [
|
|
187
|
-
Object {
|
|
188
|
-
"branch": "7.x",
|
|
189
|
-
"number": 99,
|
|
190
|
-
"state": "MERGED",
|
|
191
|
-
},
|
|
192
|
-
Object {
|
|
193
|
-
"branch": "7.9",
|
|
194
|
-
"number": 99,
|
|
195
|
-
"state": "MERGED",
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
"formattedMessage": "[APM] Increase \`xpack.apm.ui.transactionGroupBucketSize\` (#71661)",
|
|
199
|
-
"originalMessage": "[APM] Increase \`xpack.apm.ui.transactionGroupBucketSize\` (#71661)",
|
|
200
|
-
"pullNumber": 71661,
|
|
201
|
-
"sha": "51a862988c344b34bd9da57dd57008df12e1b5e5",
|
|
202
|
-
"sourceBranch": "master",
|
|
203
|
-
"targetBranchesFromLabels": Array [],
|
|
204
|
-
},
|
|
205
|
-
Object {
|
|
206
|
-
"existingTargetPullRequests": Array [
|
|
207
|
-
Object {
|
|
208
|
-
"branch": "7.9",
|
|
209
|
-
"number": 99,
|
|
210
|
-
"state": "MERGED",
|
|
211
|
-
},
|
|
212
|
-
Object {
|
|
213
|
-
"branch": "7.x",
|
|
214
|
-
"number": 99,
|
|
215
|
-
"state": "MERGED",
|
|
216
|
-
},
|
|
217
|
-
],
|
|
218
|
-
"formattedMessage": "[APM] Handle ML errors (#72316)",
|
|
219
|
-
"originalMessage": "[APM] Handle ML errors (#72316)
|
|
220
|
-
|
|
221
|
-
* [APM] Handle ML errors
|
|
222
|
-
|
|
223
|
-
* Add capability check
|
|
224
|
-
|
|
225
|
-
* Improve test
|
|
226
|
-
|
|
227
|
-
* Address Caue’s feedback
|
|
228
|
-
|
|
229
|
-
* Move getSeverity
|
|
230
|
-
|
|
231
|
-
* Fix tsc
|
|
232
|
-
|
|
233
|
-
* Fix copy",
|
|
234
|
-
"pullNumber": 72316,
|
|
235
|
-
"sha": "511e4543a7828cf0cdb157b88b01352947e0384f",
|
|
236
|
-
"sourceBranch": "master",
|
|
237
|
-
"targetBranchesFromLabels": Array [],
|
|
238
|
-
},
|
|
239
|
-
]
|
|
240
|
-
`);
|
|
241
|
-
});
|
|
242
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { PullRequestNode } from '../../../types/Commit';
|
|
2
|
-
export declare type ExistingTargetPullRequests = ReturnType<typeof getExistingTargetPullRequests>;
|
|
3
|
-
export declare function getExistingTargetPullRequests(sourcePullRequest?: PullRequestNode): {
|
|
4
|
-
number: any;
|
|
5
|
-
branch: any;
|
|
6
|
-
state: any;
|
|
7
|
-
}[];
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExistingTargetPullRequests = void 0;
|
|
4
|
-
const filterEmpty_1 = require("../../../utils/filterEmpty");
|
|
5
|
-
const commitFormatters_1 = require("../commitFormatters");
|
|
6
|
-
function getExistingTargetPullRequests(sourcePullRequest) {
|
|
7
|
-
if (!sourcePullRequest || !sourcePullRequest.mergeCommit) {
|
|
8
|
-
return [];
|
|
9
|
-
}
|
|
10
|
-
const sourcePRMergeCommitMessage = (0, commitFormatters_1.getFirstCommitMessageLine)(sourcePullRequest.mergeCommit.message);
|
|
11
|
-
return sourcePullRequest.timelineItems.edges
|
|
12
|
-
.filter(filterEmpty_1.filterNil)
|
|
13
|
-
.filter(filterPullRequests)
|
|
14
|
-
.filter((item) => {
|
|
15
|
-
const { source } = item.node;
|
|
16
|
-
if (source.state !== 'MERGED' && source.state !== 'OPEN') {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
// at least one of the commits in the target pull request should match the merge commit from the source pull request
|
|
20
|
-
const commitMatch = source.commits.edges.some((commit) => {
|
|
21
|
-
const targetPRCommitMessage = (0, commitFormatters_1.getFirstCommitMessageLine)(commit.node.commit.message);
|
|
22
|
-
return targetPRCommitMessage === sourcePRMergeCommitMessage;
|
|
23
|
-
});
|
|
24
|
-
const prTitleMatch = source.title.includes(sourcePRMergeCommitMessage);
|
|
25
|
-
const prNumberMatch = source.title.includes(sourcePullRequest.number.toString());
|
|
26
|
-
return commitMatch || (prTitleMatch && prNumberMatch);
|
|
27
|
-
})
|
|
28
|
-
.map((item) => {
|
|
29
|
-
const { source } = item.node;
|
|
30
|
-
return {
|
|
31
|
-
number: source.number,
|
|
32
|
-
branch: source.baseRefName,
|
|
33
|
-
state: source.state,
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
exports.getExistingTargetPullRequests = getExistingTargetPullRequests;
|
|
38
|
-
function filterPullRequests(item) {
|
|
39
|
-
const { source } = item.node;
|
|
40
|
-
// filter out non-prs
|
|
41
|
-
if (source.__typename !== 'PullRequest') {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { ConfigFileOptions } from '../../../../options/ConfigOptions';
|
|
2
|
-
import { OptionsFromCliArgs } from '../../../../options/cliArgs';
|
|
3
|
-
export declare type OptionsFromGithub = Awaited<ReturnType<typeof getOptionsFromGithub>>;
|
|
4
|
-
export declare function getOptionsFromGithub(optionsFromConfigFiles: ConfigFileOptions, optionsFromCliArgs: OptionsFromCliArgs): Promise<{
|
|
5
|
-
historicalBranchLabelMappings: {
|
|
6
|
-
branchLabelMapping: Record<string, string>;
|
|
7
|
-
committedDate: string;
|
|
8
|
-
}[];
|
|
9
|
-
accessToken?: string | undefined;
|
|
10
|
-
all?: boolean | undefined;
|
|
11
|
-
assignees?: string[] | undefined;
|
|
12
|
-
author?: string | undefined;
|
|
13
|
-
autoAssign?: boolean | undefined;
|
|
14
|
-
autoFixConflicts?: (({ files, directory, logger, targetBranch, }: {
|
|
15
|
-
files: string[];
|
|
16
|
-
directory: string;
|
|
17
|
-
logger: {
|
|
18
|
-
error: (message: string, meta?: unknown) => void;
|
|
19
|
-
warn: (message: string, meta?: unknown) => void;
|
|
20
|
-
info: (message: string, meta?: unknown) => void;
|
|
21
|
-
verbose: (message: string, meta?: unknown) => void;
|
|
22
|
-
debug: (message: string, meta?: unknown) => void;
|
|
23
|
-
};
|
|
24
|
-
targetBranch: string;
|
|
25
|
-
}) => boolean | Promise<boolean>) | undefined;
|
|
26
|
-
autoMerge?: boolean | undefined;
|
|
27
|
-
autoMergeMethod?: string | undefined;
|
|
28
|
-
ci?: boolean | undefined;
|
|
29
|
-
cherrypickRef?: boolean | undefined;
|
|
30
|
-
commitPaths?: string[] | undefined;
|
|
31
|
-
details?: boolean | undefined;
|
|
32
|
-
editor?: string | undefined;
|
|
33
|
-
forceLocalConfig?: boolean | undefined;
|
|
34
|
-
fork?: boolean | undefined;
|
|
35
|
-
gitHostname?: string | undefined;
|
|
36
|
-
githubApiBaseUrlV3?: string | undefined;
|
|
37
|
-
githubApiBaseUrlV4?: string | undefined;
|
|
38
|
-
maxNumber?: number | undefined;
|
|
39
|
-
multiple?: boolean | undefined;
|
|
40
|
-
multipleBranches?: boolean | undefined;
|
|
41
|
-
multipleCommits?: boolean | undefined;
|
|
42
|
-
noVerify?: boolean | undefined;
|
|
43
|
-
prDescription?: string | undefined;
|
|
44
|
-
prFilter?: string | undefined;
|
|
45
|
-
prTitle?: string | undefined;
|
|
46
|
-
pullNumber?: number | undefined;
|
|
47
|
-
repoOwner?: string | undefined;
|
|
48
|
-
repoName?: string | undefined;
|
|
49
|
-
resetAuthor?: boolean | undefined;
|
|
50
|
-
reviewers?: string[] | undefined;
|
|
51
|
-
sha?: string | undefined;
|
|
52
|
-
sourceBranch: string;
|
|
53
|
-
sourcePRLabels?: string[] | undefined;
|
|
54
|
-
targetBranchChoices?: import("../../../../options/ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
55
|
-
targetBranches?: string[] | undefined;
|
|
56
|
-
targetPRLabels?: string[] | undefined;
|
|
57
|
-
username?: string | undefined;
|
|
58
|
-
verbose?: boolean | undefined;
|
|
59
|
-
branchLabelMapping?: Record<string, string> | undefined;
|
|
60
|
-
upstream?: string | undefined;
|
|
61
|
-
branches?: import("../../../../options/ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
62
|
-
labels?: string[] | undefined;
|
|
63
|
-
}>;
|