backport 5.6.3 → 6.0.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/README.md +48 -39
- package/dist/entrypoint.cli.js +1 -1
- package/dist/entrypoint.module.d.ts +6 -5
- package/dist/entrypoint.module.js +8 -6
- package/dist/ink.d.ts +1 -0
- package/dist/ink.js +49 -0
- package/dist/main.d.ts +11 -6
- package/dist/main.js +40 -24
- package/dist/options/ConfigOptions.d.ts +47 -39
- package/dist/options/cliArgs.d.ts +28 -34
- package/dist/options/cliArgs.js +113 -94
- package/dist/options/cliArgs.test.js +103 -119
- package/dist/options/config/config.d.ts +81 -2
- package/dist/options/config/config.js +46 -6
- package/dist/options/config/config.test.js +24 -2
- package/dist/options/config/getOptionsFromGit.d.ts +3 -0
- package/dist/options/config/getOptionsFromGit.js +10 -0
- package/dist/options/config/globalConfig.d.ts +2 -1
- package/dist/options/config/globalConfig.js +8 -8
- package/dist/options/config/globalConfig.test.js +7 -3
- package/dist/options/config/projectConfig.d.ts +2 -1
- package/dist/options/config/projectConfig.js +3 -3
- package/dist/options/config/projectConfig.test.js +4 -4
- package/dist/options/config/readConfigFile.d.ts +2 -2
- package/dist/options/config/readConfigFile.js +3 -3
- package/dist/options/options.d.ts +40 -27
- package/dist/options/options.js +8 -16
- package/dist/options/options.test.js +66 -26
- package/dist/options/parseRequiredOptions.d.ts +71 -0
- package/dist/options/parseRequiredOptions.js +70 -0
- package/dist/options/parseRequiredOptions.test.d.ts +1 -0
- package/dist/options/parseRequiredOptions.test.js +127 -0
- package/dist/runSequentially.d.ts +20 -0
- package/dist/runSequentially.js +41 -0
- package/dist/runSequentially.test.d.ts +1 -0
- package/dist/runSequentially.test.js +235 -0
- package/dist/runWithOptions.js +7 -14
- package/dist/runWithOptions.test.js +142 -16
- package/dist/scripts/generate-gql.d.ts +1 -0
- package/dist/scripts/generate-gql.js +15 -0
- package/dist/scripts/postinstall.js +4 -4
- package/dist/scripts/postinstall.test.js +9 -2
- package/dist/scripts/runPostinstall.js +1 -1
- package/dist/services/HandledError.d.ts +11 -1
- package/dist/services/HandledError.js +2 -1
- package/dist/services/child-process-promisified.d.ts +1 -1
- package/dist/services/child-process-promisified.js +2 -2
- package/dist/services/env.js +5 -5
- package/dist/services/env.test.js +11 -4
- package/dist/services/fs-promisified.js +4 -4
- package/dist/services/getExpectedTarget.d.ts +9 -0
- package/dist/services/getExpectedTarget.js +77 -0
- package/dist/services/getExpectedTargetPullRequests.d.ts +9 -0
- package/dist/services/getExpectedTargetPullRequests.js +77 -0
- package/dist/services/git.d.ts +19 -4
- package/dist/services/git.integration.test.d.ts +1 -0
- package/dist/services/git.integration.test.js +168 -0
- package/dist/services/git.js +129 -57
- package/dist/services/git.test.js +155 -51
- package/dist/services/github/commitFormatters.d.ts +3 -7
- package/dist/services/github/commitFormatters.js +10 -19
- package/dist/services/github/commitFormatters.test.js +2 -24
- package/dist/services/github/v3/addAssigneesToPullRequest.d.ts +1 -1
- package/dist/services/github/v3/addAssigneesToPullRequest.js +2 -6
- package/dist/services/github/v3/addAssigneesToPullRequest.test.js +2 -3
- package/dist/services/github/v3/addLabelsToPullRequest.d.ts +1 -1
- package/dist/services/github/v3/addLabelsToPullRequest.js +2 -6
- package/dist/services/github/v3/addReviewersToPullRequest.d.ts +2 -0
- package/dist/services/github/v3/addReviewersToPullRequest.js +34 -0
- package/dist/services/github/v3/createPullRequest.d.ts +3 -2
- package/dist/services/github/v3/createPullRequest.js +33 -24
- package/dist/services/github/v3/createStatusComment.d.ts +11 -0
- package/dist/services/github/v3/createStatusComment.js +97 -0
- package/dist/services/github/v3/createStatusComment.test.d.ts +1 -0
- package/dist/services/github/v3/createStatusComment.test.js +209 -0
- package/dist/services/github/v4/FetchPullRequestId.d.ts +9 -0
- package/dist/services/github/v4/FetchPullRequestId.js +32 -0
- package/dist/services/github/v4/apiRequestV4.d.ts +1 -1
- package/dist/services/github/v4/apiRequestV4.js +8 -10
- package/dist/services/github/v4/apiRequestV4.test.js +7 -7
- package/dist/services/github/v4/disablePullRequestAutoMerge.d.ts +9 -0
- package/dist/services/github/v4/disablePullRequestAutoMerge.js +28 -0
- package/dist/services/github/v4/enablePullRequestAutoMerge.d.ts +9 -0
- package/dist/services/github/v4/enablePullRequestAutoMerge.js +51 -0
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.d.ts +1 -0
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +113 -0
- package/dist/services/github/v4/fetchAuthorId.d.ts +5 -0
- package/dist/services/github/v4/fetchAuthorId.js +1 -1
- package/dist/services/github/v4/fetchAuthorId.private.test.js +3 -3
- package/dist/services/github/v4/fetchCommitByPullNumber.js +11 -9
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +6 -6
- package/dist/services/github/v4/fetchCommitBySha.js +14 -12
- package/dist/services/github/v4/fetchCommitBySha.private.test.js +7 -5
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +5 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +46 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +67 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.d.ts +5 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +36 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +55 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +16 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +90 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +130 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +127 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +28 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +52 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +10 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +49 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +81 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +252 -0
- package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +3 -2
- package/dist/services/github/v4/fetchCommitsByAuthor.js +81 -70
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +81 -8
- package/dist/services/github/v4/fetchCommitsByAuthor.test.js +29 -21
- package/dist/services/github/v4/fetchDefaultBranch.d.ts +1 -1
- package/dist/services/github/v4/fetchDefaultBranch.js +1 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +4 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.js +52 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +32 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.d.ts +4 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.js +72 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.js +34 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.d.ts +40 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.js +72 -0
- package/dist/services/github/v4/fetchExistingPullRequest.js +2 -3
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +3 -3
- package/dist/services/github/v4/fetchMergedPullRequests.d.ts +19 -20
- package/dist/services/github/v4/fetchMergedPullRequests.js +22 -68
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +8 -9
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +11 -0
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.js +35 -0
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.d.ts +1 -1
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +12 -10
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +8 -6
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +2 -2
- package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +4 -58
- package/dist/services/github/v4/getExistingTargetPullRequests.js +3 -58
- package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +61 -0
- package/dist/services/github/v4/getOptionsFromGithub/index.js +139 -0
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.d.ts +1 -0
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +126 -0
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +34 -0
- package/dist/services/github/v4/getOptionsFromGithub/query.js +44 -0
- package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -7
- package/dist/services/github/v4/getTargetBranchesFromLabels.js +1 -26
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +69 -32
- package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +2 -2
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +39 -25
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +2 -2
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +10 -0
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +2 -2
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +4 -1
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +1 -1
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +1 -0
- package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +1 -1
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -15
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +7 -7
- package/dist/services/logger.d.ts +3 -3
- package/dist/services/logger.js +24 -24
- package/dist/services/prompt.test.d.ts +1 -0
- package/dist/services/prompt.test.js +87 -0
- package/dist/services/prompts.d.ts +10 -4
- package/dist/services/prompts.js +85 -22
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +9 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +92 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +1 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +396 -0
- package/dist/services/sourceCommit/getMockSourceCommit.d.ts +21 -0
- package/dist/services/sourceCommit/getMockSourceCommit.js +67 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +5 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +20 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +1 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +201 -0
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +78 -0
- package/dist/services/sourceCommit/parseSourceCommit.js +96 -0
- package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +1 -0
- package/dist/services/sourceCommit/parseSourceCommit.test.js +114 -0
- package/dist/services/sourceCommit/sourceCommit.d.ts +78 -0
- package/dist/services/sourceCommit/sourceCommit.js +86 -0
- package/dist/services/sourceCommit/sourceCommit.test.d.ts +1 -0
- package/dist/services/sourceCommit/sourceCommit.test.js +287 -0
- package/dist/services/sourceCommit.d.ts +78 -0
- package/dist/services/sourceCommit.js +86 -0
- package/dist/services/sourceCommit.test.d.ts +1 -0
- package/dist/services/sourceCommit.test.js +280 -0
- package/dist/test/inquirer.private.test.js +81 -45
- package/dist/test/integration/createSpies.d.ts +1 -1
- package/dist/test/integration/createSpies.js +21 -9
- package/dist/test/integration/envConstants.js +5 -6
- package/dist/test/integration/helpers.js +1 -1
- package/dist/test/integration/integration.private.test.d.ts +1 -0
- package/dist/test/integration/integration.private.test.js +308 -0
- package/dist/test/integration/integration.test.js +30 -31
- package/dist/test/nockHelpers.d.ts +2 -2
- package/dist/test/nockHelpers.js +3 -7
- package/dist/test/setupFiles/automatic-mocks.d.ts +0 -1
- package/dist/test/setupFiles/automatic-mocks.js +0 -22
- package/dist/types/Commit.d.ts +85 -0
- package/dist/types/Commit.js +139 -0
- package/dist/types/commitNode.d.ts +89 -0
- package/dist/types/commitNode.js +139 -0
- package/dist/types/commitNode.test.d.ts +1 -0
- package/dist/types/commitNode.test.js +255 -0
- package/dist/types/commitWithAssociatedPullRequests.d.ts +86 -0
- package/dist/types/commitWithAssociatedPullRequests.js +145 -0
- package/dist/ui/cherrypickAndCreatePullRequest.test.js +277 -59
- package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +11 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +135 -67
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +468 -0
- package/dist/ui/getCommits.d.ts +1 -1
- package/dist/ui/getCommits.js +55 -25
- package/dist/ui/getTargetBranches.d.ts +2 -2
- package/dist/ui/getTargetBranches.js +16 -17
- package/dist/ui/getTargetBranches.test.js +75 -99
- package/dist/ui/getTargetBranchesFromLabels.d.ts +6 -0
- package/dist/ui/getTargetBranchesFromLabels.js +40 -0
- package/dist/ui/getTargetBranchesFromLabels.test.d.ts +1 -0
- package/dist/ui/getTargetBranchesFromLabels.test.js +288 -0
- package/dist/ui/maybeSetupRepo.js +9 -9
- package/dist/ui/maybeSetupRepo.test.js +5 -1
- package/package.json +36 -51
- package/yarn.lock +2387 -2979
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.commitsByAuthorMock = void 0;
|
|
4
|
+
exports.commitsByAuthorMock = {
|
|
5
5
|
repository: {
|
|
6
6
|
ref: {
|
|
7
7
|
target: {
|
|
@@ -9,6 +9,11 @@ exports.commitsWithPullRequestsMock = {
|
|
|
9
9
|
edges: [
|
|
10
10
|
{
|
|
11
11
|
node: {
|
|
12
|
+
repository: {
|
|
13
|
+
name: 'kibana',
|
|
14
|
+
owner: { login: 'elastic' },
|
|
15
|
+
},
|
|
16
|
+
committedDate: '2021-12-24T00:00:00Z',
|
|
12
17
|
oid: '2e63475c483f7844b0f2833bc57fdee32095bacb',
|
|
13
18
|
message: 'Add 👻',
|
|
14
19
|
associatedPullRequests: {
|
|
@@ -18,26 +23,22 @@ exports.commitsWithPullRequestsMock = {
|
|
|
18
23
|
},
|
|
19
24
|
{
|
|
20
25
|
node: {
|
|
26
|
+
repository: {
|
|
27
|
+
name: 'kibana',
|
|
28
|
+
owner: { login: 'elastic' },
|
|
29
|
+
},
|
|
30
|
+
committedDate: '2021-12-23T00:00:00Z',
|
|
21
31
|
oid: 'f3b618b9421fdecdb36862f907afbdd6344b361d',
|
|
22
32
|
message: 'Add witch (#85)',
|
|
23
33
|
associatedPullRequests: {
|
|
24
34
|
edges: [
|
|
25
35
|
{
|
|
26
36
|
node: {
|
|
37
|
+
url: 'https://github.com/elastic/kibana/pull/85',
|
|
27
38
|
baseRefName: 'master',
|
|
28
39
|
labels: {
|
|
29
40
|
nodes: [{ name: 'my-label-b' }],
|
|
30
41
|
},
|
|
31
|
-
mergeCommit: {
|
|
32
|
-
oid: 'f3b618b9421fdecdb36862f907afbdd6344b361d',
|
|
33
|
-
message: 'Add witch (#85)',
|
|
34
|
-
},
|
|
35
|
-
repository: {
|
|
36
|
-
name: 'kibana',
|
|
37
|
-
owner: {
|
|
38
|
-
login: 'elastic',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
42
|
number: 85,
|
|
42
43
|
timelineItems: {
|
|
43
44
|
edges: [],
|
|
@@ -50,24 +51,20 @@ exports.commitsWithPullRequestsMock = {
|
|
|
50
51
|
},
|
|
51
52
|
{
|
|
52
53
|
node: {
|
|
54
|
+
repository: {
|
|
55
|
+
name: 'kibana',
|
|
56
|
+
owner: { login: 'elastic' },
|
|
57
|
+
},
|
|
58
|
+
committedDate: '2021-12-22T00:00:00Z',
|
|
53
59
|
oid: '79cf18453ec32a4677009dcbab1c9c8c73fc14fe',
|
|
54
60
|
message: 'Add SF mention (#80)\n\n* Add SF mention\r\n\r\n* Add several emojis!',
|
|
55
61
|
associatedPullRequests: {
|
|
56
62
|
edges: [
|
|
57
63
|
{
|
|
58
64
|
node: {
|
|
65
|
+
url: 'https://github.com/elastic/kibana/pull/80',
|
|
59
66
|
labels: {
|
|
60
|
-
nodes: [{ name: '
|
|
61
|
-
},
|
|
62
|
-
mergeCommit: {
|
|
63
|
-
oid: '79cf18453ec32a4677009dcbab1c9c8c73fc14fe',
|
|
64
|
-
message: 'Add SF mention (#80)\n\n* Add SF mention\r\n\r\n* Add several emojis!',
|
|
65
|
-
},
|
|
66
|
-
repository: {
|
|
67
|
-
name: 'kibana',
|
|
68
|
-
owner: {
|
|
69
|
-
login: 'elastic',
|
|
70
|
-
},
|
|
67
|
+
nodes: [{ name: 'v6.3.0' }],
|
|
71
68
|
},
|
|
72
69
|
baseRefName: 'master',
|
|
73
70
|
number: 80,
|
|
@@ -75,8 +72,9 @@ exports.commitsWithPullRequestsMock = {
|
|
|
75
72
|
edges: [
|
|
76
73
|
{
|
|
77
74
|
node: {
|
|
78
|
-
|
|
75
|
+
targetPullRequest: {
|
|
79
76
|
__typename: 'PullRequest',
|
|
77
|
+
url: 'https://github.com/elastic/kibana/pull/99',
|
|
80
78
|
title: 'some title',
|
|
81
79
|
state: 'MERGED',
|
|
82
80
|
number: 99,
|
|
@@ -85,7 +83,13 @@ exports.commitsWithPullRequestsMock = {
|
|
|
85
83
|
edges: [
|
|
86
84
|
{
|
|
87
85
|
node: {
|
|
88
|
-
|
|
86
|
+
targetCommit: {
|
|
87
|
+
repository: {
|
|
88
|
+
name: 'kibana',
|
|
89
|
+
owner: { login: 'elastic' },
|
|
90
|
+
},
|
|
91
|
+
committedDate: '2021-12-23T00:00:00Z',
|
|
92
|
+
oid: 'abc',
|
|
89
93
|
message: 'Add SF mention (#80)\n\n* Add SF mention\r\n\r\n* Add several emojis!',
|
|
90
94
|
},
|
|
91
95
|
},
|
|
@@ -105,6 +109,11 @@ exports.commitsWithPullRequestsMock = {
|
|
|
105
109
|
},
|
|
106
110
|
{
|
|
107
111
|
node: {
|
|
112
|
+
repository: {
|
|
113
|
+
name: 'kibana',
|
|
114
|
+
owner: { login: 'elastic' },
|
|
115
|
+
},
|
|
116
|
+
committedDate: '2021-12-21T00:00:00Z',
|
|
108
117
|
oid: '3827bbbaf39914eda4f02f6940189844375fd097',
|
|
109
118
|
message: 'Add backport config',
|
|
110
119
|
associatedPullRequests: {
|
|
@@ -114,6 +123,11 @@ exports.commitsWithPullRequestsMock = {
|
|
|
114
123
|
},
|
|
115
124
|
{
|
|
116
125
|
node: {
|
|
126
|
+
repository: {
|
|
127
|
+
name: 'kibana',
|
|
128
|
+
owner: { login: 'elastic' },
|
|
129
|
+
},
|
|
130
|
+
committedDate: '2021-12-20T00:00:00Z',
|
|
117
131
|
oid: '5ea0da550ac191029459289d67f99ad7d310812b',
|
|
118
132
|
message: 'Initial commit',
|
|
119
133
|
associatedPullRequests: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const fetchPullRequestBySearchQueryMock:
|
|
1
|
+
import { PullRequestBySearchQueryResponse } from '../fetchCommits/fetchPullRequestBySearchQuery';
|
|
2
|
+
export declare const fetchPullRequestBySearchQueryMock: PullRequestBySearchQueryResponse;
|
|
@@ -13,6 +13,7 @@ exports.fetchPullRequestBySearchQueryMock = {
|
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
mergeCommit: {
|
|
16
|
+
committedDate: '2021-01-01T00:00:00',
|
|
16
17
|
oid: 'e0f4775b780aada005bdd1774edcceac0ffee006',
|
|
17
18
|
message: '[APM] @ts-error -> @ts-expect-error (#76492)\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>',
|
|
18
19
|
},
|
|
@@ -66,6 +67,7 @@ exports.fetchPullRequestBySearchQueryMock = {
|
|
|
66
67
|
},
|
|
67
68
|
},
|
|
68
69
|
mergeCommit: {
|
|
70
|
+
committedDate: '2021-01-01T00:00:00',
|
|
69
71
|
oid: 'fae1e02e0f7a475bf92da05be52a817aa2a84959',
|
|
70
72
|
message: '[APM] Avoid negative offset for error marker on timeline (#76638)\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>',
|
|
71
73
|
},
|
|
@@ -119,6 +121,7 @@ exports.fetchPullRequestBySearchQueryMock = {
|
|
|
119
121
|
},
|
|
120
122
|
},
|
|
121
123
|
mergeCommit: {
|
|
124
|
+
committedDate: '2021-01-01T00:00:00',
|
|
122
125
|
oid: 'aa68e3b63a4b513294dc58eaf4422e66a0beffb1',
|
|
123
126
|
message: '[APM] Add anomaly detection API tests + fixes (#73120)\n\nCo-authored-by: Nathan L Smith <nathan.smith@elastic.co>',
|
|
124
127
|
},
|
|
@@ -211,6 +214,7 @@ exports.fetchPullRequestBySearchQueryMock = {
|
|
|
211
214
|
},
|
|
212
215
|
},
|
|
213
216
|
mergeCommit: {
|
|
217
|
+
committedDate: '2021-01-01T00:00:00',
|
|
214
218
|
oid: '2fc7112ec27a9f8ded0e2f9e097613721f1179dd',
|
|
215
219
|
message: '[APM] Update script with new roles/users (#72599)\n\n* [APM] Update script with new roles/users\r\n\r\n* add log\r\n\r\n* Add validation for http prefix',
|
|
216
220
|
},
|
|
@@ -244,6 +248,7 @@ exports.fetchPullRequestBySearchQueryMock = {
|
|
|
244
248
|
},
|
|
245
249
|
},
|
|
246
250
|
mergeCommit: {
|
|
251
|
+
committedDate: '2021-01-01T00:00:00',
|
|
247
252
|
oid: '7e126bfab6a3bfc44f9fa50feecfe22b4634e1a0',
|
|
248
253
|
message: 'Update jobs_list.tsx (#72797)',
|
|
249
254
|
},
|
|
@@ -322,6 +327,7 @@ exports.fetchPullRequestBySearchQueryMock = {
|
|
|
322
327
|
},
|
|
323
328
|
},
|
|
324
329
|
mergeCommit: {
|
|
330
|
+
committedDate: '2021-01-01T00:00:00',
|
|
325
331
|
oid: 'd12208c7ea9513529ea1aff42d154db89e3573ff',
|
|
326
332
|
message: '[APM] Fix confusing request/minute viz (#69143)',
|
|
327
333
|
},
|
|
@@ -381,6 +387,7 @@ exports.fetchPullRequestBySearchQueryMock = {
|
|
|
381
387
|
},
|
|
382
388
|
},
|
|
383
389
|
mergeCommit: {
|
|
390
|
+
committedDate: '2021-01-01T00:00:00',
|
|
384
391
|
oid: 'f760d8513b0216a73e9a476661f0fb8fb0887a61',
|
|
385
392
|
message: '[APM] Remove watcher integration (#71655)',
|
|
386
393
|
},
|
|
@@ -440,6 +447,7 @@ exports.fetchPullRequestBySearchQueryMock = {
|
|
|
440
447
|
},
|
|
441
448
|
},
|
|
442
449
|
mergeCommit: {
|
|
450
|
+
committedDate: '2021-01-01T00:00:00',
|
|
443
451
|
oid: '05ee3da80db34ccf93e7424aa2704c098a1b49fa',
|
|
444
452
|
message: '[APM] Disable flaky rum e2e’s (#72614)',
|
|
445
453
|
},
|
|
@@ -525,6 +533,7 @@ exports.fetchPullRequestBySearchQueryMock = {
|
|
|
525
533
|
},
|
|
526
534
|
},
|
|
527
535
|
mergeCommit: {
|
|
536
|
+
committedDate: '2021-01-01T00:00:00',
|
|
528
537
|
oid: '51a862988c344b34bd9da57dd57008df12e1b5e5',
|
|
529
538
|
message: '[APM] Increase `xpack.apm.ui.transactionGroupBucketSize` (#71661)',
|
|
530
539
|
},
|
|
@@ -664,6 +673,7 @@ exports.fetchPullRequestBySearchQueryMock = {
|
|
|
664
673
|
},
|
|
665
674
|
},
|
|
666
675
|
mergeCommit: {
|
|
676
|
+
committedDate: '2021-01-01T00:00:00',
|
|
667
677
|
oid: '511e4543a7828cf0cdb157b88b01352947e0384f',
|
|
668
678
|
message: '[APM] Handle ML errors (#72316)\n\n* [APM] Handle ML errors\r\n\r\n* Add capability check\r\n\r\n* Improve test\r\n\r\n* Address Caue’s feedback\r\n\r\n* Move getSeverity\r\n\r\n* Fix tsc\r\n\r\n* Fix copy',
|
|
669
679
|
},
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const getCommitsByAuthorMock: (repoName: string) =>
|
|
1
|
+
import { CommitByAuthorResponse } from '../fetchCommits/fetchCommitsByAuthor';
|
|
2
|
+
export declare const getCommitsByAuthorMock: (repoName: string) => CommitByAuthorResponse;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCommitsByAuthorMock = void 0;
|
|
4
|
-
|
|
4
|
+
const getCommitsByAuthorMock = (repoName) => ({
|
|
5
5
|
repository: {
|
|
6
6
|
ref: {
|
|
7
7
|
target: {
|
|
@@ -9,6 +9,7 @@ exports.getCommitsByAuthorMock = (repoName) => ({
|
|
|
9
9
|
edges: [
|
|
10
10
|
{
|
|
11
11
|
node: {
|
|
12
|
+
committedDate: '2021-12-13T22:46:29Z',
|
|
12
13
|
oid: '79cf18453ec32a4677009dcbab1c9c8c73fc14fe',
|
|
13
14
|
message: 'Add SF mention (#80)\n\n* Add SF mention\r\n\r\n* Add several emojis!',
|
|
14
15
|
associatedPullRequests: {
|
|
@@ -20,6 +21,7 @@ exports.getCommitsByAuthorMock = (repoName) => ({
|
|
|
20
21
|
nodes: [{ name: 'my-label-a' }],
|
|
21
22
|
},
|
|
22
23
|
mergeCommit: {
|
|
24
|
+
committedDate: '2021-12-13T22:46:29Z',
|
|
23
25
|
oid: '79cf18453ec32a4677009dcbab1c9c8c73fc14fe',
|
|
24
26
|
message: 'Add SF mention (#80)\n\n* Add SF mention\r\n\r\n* Add several emojis!',
|
|
25
27
|
},
|
|
@@ -68,3 +70,4 @@ exports.getCommitsByAuthorMock = (repoName) => ({
|
|
|
68
70
|
},
|
|
69
71
|
},
|
|
70
72
|
});
|
|
73
|
+
exports.getCommitsByAuthorMock = getCommitsByAuthorMock;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PullRequestNode } from '
|
|
1
|
+
import { PullRequestNode } from '../../../../types/commitNode';
|
|
2
2
|
export declare function getPullRequestNodeMock({ sourcePullRequest, targetPullRequest, }: {
|
|
3
3
|
sourcePullRequest: {
|
|
4
4
|
commitMessage: string;
|
|
@@ -3,5 +3,5 @@ import { GithubV4Response } from './apiRequestV4';
|
|
|
3
3
|
export declare function throwOnInvalidAccessToken({ repoOwner, repoName, error, }: {
|
|
4
4
|
repoOwner: string;
|
|
5
5
|
repoName: string;
|
|
6
|
-
error: AxiosError<GithubV4Response<
|
|
6
|
+
error: AxiosError<GithubV4Response<unknown>>;
|
|
7
7
|
}): void;
|
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.throwOnInvalidAccessToken = void 0;
|
|
7
|
-
const
|
|
8
|
-
const lodash_isempty_1 = __importDefault(require("lodash.isempty"));
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
9
5
|
const HandledError_1 = require("../../HandledError");
|
|
10
6
|
const env_1 = require("../../env");
|
|
11
7
|
function throwOnInvalidAccessToken({ repoOwner, repoName, error, }) {
|
|
12
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
13
8
|
function getSSOAuthUrl(ssoHeader) {
|
|
14
|
-
const matches = ssoHeader
|
|
9
|
+
const matches = ssoHeader?.match(/url=(.*)/);
|
|
15
10
|
if (matches) {
|
|
16
11
|
return matches[1];
|
|
17
12
|
}
|
|
18
13
|
}
|
|
19
|
-
const statusCode =
|
|
14
|
+
const statusCode = error.response?.status;
|
|
20
15
|
switch (statusCode) {
|
|
21
16
|
case 200: {
|
|
22
|
-
const repoNotFound =
|
|
23
|
-
const grantedScopes =
|
|
24
|
-
const requiredScopes =
|
|
25
|
-
const ssoHeader =
|
|
17
|
+
const repoNotFound = error.response?.data.errors?.some((error) => error.type === 'NOT_FOUND' && error.path.join('.') === 'repository');
|
|
18
|
+
const grantedScopes = error.response?.headers['x-oauth-scopes'] || '';
|
|
19
|
+
const requiredScopes = error.response?.headers['x-accepted-oauth-scopes'] || '';
|
|
20
|
+
const ssoHeader = error.response?.headers['x-github-sso'];
|
|
26
21
|
if (repoNotFound) {
|
|
27
|
-
const hasRequiredScopes =
|
|
22
|
+
const hasRequiredScopes = (0, lodash_1.isEmpty)((0, lodash_1.difference)(requiredScopes.split(','), grantedScopes.split(',')));
|
|
28
23
|
// user does not have permission to the repo
|
|
29
24
|
if (!hasRequiredScopes) {
|
|
30
25
|
throw new HandledError_1.HandledError(`You do not have access to the repository "${repoOwner}/${repoName}". Please make sure your access token has the required scopes.\n\nRequired scopes: ${requiredScopes}\nAccess token scopes: ${grantedScopes}`);
|
|
@@ -32,7 +27,7 @@ function throwOnInvalidAccessToken({ repoOwner, repoName, error, }) {
|
|
|
32
27
|
// repo does not exist
|
|
33
28
|
throw new HandledError_1.HandledError(`The repository "${repoOwner}/${repoName}" doesn't exist`);
|
|
34
29
|
}
|
|
35
|
-
const repoAccessForbidden =
|
|
30
|
+
const repoAccessForbidden = error.response?.data.errors?.some((error) => error.type === 'FORBIDDEN');
|
|
36
31
|
const ssoAuthUrl = getSSOAuthUrl(ssoHeader);
|
|
37
32
|
// user does not have permissions
|
|
38
33
|
if (repoAccessForbidden && ssoAuthUrl) {
|
|
@@ -41,7 +36,7 @@ function throwOnInvalidAccessToken({ repoOwner, repoName, error, }) {
|
|
|
41
36
|
break;
|
|
42
37
|
}
|
|
43
38
|
case 401:
|
|
44
|
-
throw new HandledError_1.HandledError(`Please check your access token and make sure it is valid.\nConfig: ${env_1.getGlobalConfigPath()}`);
|
|
39
|
+
throw new HandledError_1.HandledError(`Please check your access token and make sure it is valid.\nConfig: ${(0, env_1.getGlobalConfigPath)()}`);
|
|
45
40
|
}
|
|
46
41
|
}
|
|
47
42
|
exports.throwOnInvalidAccessToken = throwOnInvalidAccessToken;
|
|
@@ -10,7 +10,7 @@ describe('throwOnInvalidAccessToken', () => {
|
|
|
10
10
|
headers: {},
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
|
-
return expect(() => throwOnInvalidAccessToken_1.throwOnInvalidAccessToken({
|
|
13
|
+
return expect(() => (0, throwOnInvalidAccessToken_1.throwOnInvalidAccessToken)({
|
|
14
14
|
repoOwner: 'elastic',
|
|
15
15
|
repoName: 'kibana',
|
|
16
16
|
error,
|
|
@@ -26,7 +26,7 @@ describe('throwOnInvalidAccessToken', () => {
|
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
};
|
|
29
|
-
return expect(() => throwOnInvalidAccessToken_1.throwOnInvalidAccessToken({
|
|
29
|
+
return expect(() => (0, throwOnInvalidAccessToken_1.throwOnInvalidAccessToken)({
|
|
30
30
|
repoOwner: 'elastic',
|
|
31
31
|
repoName: 'kibana',
|
|
32
32
|
error,
|
|
@@ -41,11 +41,11 @@ describe('throwOnInvalidAccessToken', () => {
|
|
|
41
41
|
'x-accepted-oauth-scopes': 'a,b,c',
|
|
42
42
|
},
|
|
43
43
|
data: {
|
|
44
|
-
errors: [{ type: 'NOT_FOUND' }],
|
|
44
|
+
errors: [{ type: 'NOT_FOUND', path: ['repository'] }],
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
47
|
};
|
|
48
|
-
return expect(() => throwOnInvalidAccessToken_1.throwOnInvalidAccessToken({
|
|
48
|
+
return expect(() => (0, throwOnInvalidAccessToken_1.throwOnInvalidAccessToken)({
|
|
49
49
|
repoOwner: 'elastic',
|
|
50
50
|
repoName: 'kibana',
|
|
51
51
|
error,
|
|
@@ -60,11 +60,11 @@ describe('throwOnInvalidAccessToken', () => {
|
|
|
60
60
|
'x-accepted-oauth-scopes': 'a,b,c',
|
|
61
61
|
},
|
|
62
62
|
data: {
|
|
63
|
-
errors: [{ type: 'NOT_FOUND' }],
|
|
63
|
+
errors: [{ type: 'NOT_FOUND', path: ['repository'] }],
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
};
|
|
67
|
-
return expect(() => throwOnInvalidAccessToken_1.throwOnInvalidAccessToken({
|
|
67
|
+
return expect(() => (0, throwOnInvalidAccessToken_1.throwOnInvalidAccessToken)({
|
|
68
68
|
repoOwner: 'elastic',
|
|
69
69
|
repoName: 'kibana',
|
|
70
70
|
error,
|
|
@@ -77,7 +77,7 @@ describe('throwOnInvalidAccessToken', () => {
|
|
|
77
77
|
headers: {},
|
|
78
78
|
},
|
|
79
79
|
};
|
|
80
|
-
return expect(throwOnInvalidAccessToken_1.throwOnInvalidAccessToken({
|
|
80
|
+
return expect((0, throwOnInvalidAccessToken_1.throwOnInvalidAccessToken)({
|
|
81
81
|
repoOwner: 'elastic',
|
|
82
82
|
repoName: 'kibana',
|
|
83
83
|
error,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConfigFileOptions } from '../options/ConfigOptions';
|
|
2
2
|
export declare function consoleLog(message: string): void;
|
|
3
3
|
export declare type Logger = typeof logger;
|
|
4
4
|
export declare const logger: {
|
|
@@ -8,8 +8,8 @@ export declare const logger: {
|
|
|
8
8
|
verbose: (message: string, meta?: unknown) => void;
|
|
9
9
|
debug: (message: string, meta?: unknown) => void;
|
|
10
10
|
};
|
|
11
|
-
export declare function updateLogger(options:
|
|
12
|
-
export declare function
|
|
11
|
+
export declare function updateLogger(options: ConfigFileOptions): void;
|
|
12
|
+
export declare function redactAccessToken(str: string): string;
|
|
13
13
|
export declare function initLogger(): {
|
|
14
14
|
error: (message: string, meta?: unknown) => void;
|
|
15
15
|
warn: (message: string, meta?: unknown) => void;
|
package/dist/services/logger.js
CHANGED
|
@@ -22,9 +22,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.initLogger = exports.
|
|
25
|
+
exports.initLogger = exports.redactAccessToken = exports.updateLogger = exports.logger = exports.consoleLog = void 0;
|
|
26
26
|
const dedent_1 = __importDefault(require("dedent"));
|
|
27
|
-
const
|
|
27
|
+
const lodash_1 = require("lodash");
|
|
28
28
|
const safe_json_stringify_1 = __importDefault(require("safe-json-stringify"));
|
|
29
29
|
const winston_1 = __importStar(require("winston"));
|
|
30
30
|
const env_1 = require("./env");
|
|
@@ -33,70 +33,70 @@ let winstonInstance;
|
|
|
33
33
|
// wrapper around console.log
|
|
34
34
|
function consoleLog(message) {
|
|
35
35
|
// eslint-disable-next-line no-console
|
|
36
|
-
console.log(
|
|
36
|
+
console.log(redactAccessToken(message));
|
|
37
37
|
//process.stdout.write(message);
|
|
38
38
|
}
|
|
39
39
|
exports.consoleLog = consoleLog;
|
|
40
40
|
exports.logger = {
|
|
41
41
|
error: (message, meta) => {
|
|
42
|
-
winstonInstance.error(message, { meta });
|
|
42
|
+
winstonInstance.error(message, null, { meta });
|
|
43
43
|
},
|
|
44
44
|
warn: (message, meta) => {
|
|
45
|
-
winstonInstance.warn(message, { meta });
|
|
45
|
+
winstonInstance.warn(message, null, { meta });
|
|
46
46
|
},
|
|
47
47
|
info: (message, meta) => {
|
|
48
|
-
winstonInstance.info(message, { meta });
|
|
48
|
+
winstonInstance.info(message, null, { meta });
|
|
49
49
|
},
|
|
50
50
|
verbose: (message, meta) => {
|
|
51
|
-
winstonInstance.verbose(message, { meta });
|
|
51
|
+
winstonInstance.verbose(message, null, { meta });
|
|
52
52
|
},
|
|
53
53
|
debug: (message, meta) => {
|
|
54
|
-
winstonInstance.debug(message, { meta });
|
|
54
|
+
winstonInstance.debug(message, null, { meta });
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
|
-
let
|
|
57
|
+
let accessToken;
|
|
58
58
|
function updateLogger(options) {
|
|
59
|
-
|
|
59
|
+
accessToken = options.accessToken;
|
|
60
60
|
// set log level
|
|
61
|
-
|
|
62
|
-
winstonInstance.level = 'debug';
|
|
63
|
-
}
|
|
61
|
+
winstonInstance.level = options.verbose ? 'debug' : 'info';
|
|
64
62
|
// output logs to console in ci env
|
|
65
63
|
if (options.ci) {
|
|
66
64
|
winstonInstance.add(new winston_1.default.transports.Console());
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
67
|
exports.updateLogger = updateLogger;
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
function redactAccessToken(str) {
|
|
69
|
+
// `redactAccessToken` might be called before access token is set
|
|
70
|
+
if (accessToken) {
|
|
71
|
+
return str.replace(new RegExp(accessToken, 'g'), '<REDACTED>');
|
|
73
72
|
}
|
|
74
73
|
return str;
|
|
75
74
|
}
|
|
76
|
-
exports.
|
|
75
|
+
exports.redactAccessToken = redactAccessToken;
|
|
77
76
|
function initLogger() {
|
|
78
77
|
winstonInstance = winston_1.default.createLogger({
|
|
79
78
|
transports: [
|
|
80
79
|
// log to file
|
|
81
80
|
new winston_1.default.transports.File({
|
|
82
|
-
|
|
81
|
+
level: 'debug',
|
|
82
|
+
format: combine(winston_1.format.splat(), winston_1.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston_1.default.format.metadata({
|
|
83
83
|
fillExcept: ['message', 'level', 'timestamp', 'label'],
|
|
84
84
|
}), winston_1.format.printf((info) => {
|
|
85
85
|
// format without metadata
|
|
86
86
|
if (!info.metadata.meta) {
|
|
87
|
-
return
|
|
87
|
+
return redactAccessToken(`${info.timestamp}: ${info.message}`);
|
|
88
88
|
}
|
|
89
89
|
// format when metadata is a string
|
|
90
|
-
if (
|
|
91
|
-
return
|
|
90
|
+
if ((0, lodash_1.isString)(info.metadata.meta)) {
|
|
91
|
+
return redactAccessToken(`${info.timestamp}: ${info.message}\n${(0, dedent_1.default)(info.metadata.meta)}\n`);
|
|
92
92
|
}
|
|
93
93
|
if (info.metadata.meta.stack) {
|
|
94
|
-
return
|
|
94
|
+
return redactAccessToken(`${info.timestamp}: ${info.message}\n${info.metadata.meta.stack}\n`);
|
|
95
95
|
}
|
|
96
96
|
// format when metadata is an object
|
|
97
|
-
return
|
|
97
|
+
return redactAccessToken(`${info.timestamp}: ${info.message}\n${(0, safe_json_stringify_1.default)(info.metadata.meta, null, 2)}\n`);
|
|
98
98
|
})),
|
|
99
|
-
filename: env_1.getLogfilePath(),
|
|
99
|
+
filename: (0, env_1.getLogfilePath)(),
|
|
100
100
|
}),
|
|
101
101
|
],
|
|
102
102
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
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 strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
7
|
+
const prompts_1 = require("./prompts");
|
|
8
|
+
describe('prompt', () => {
|
|
9
|
+
describe('getChoicesForCommitPrompt', () => {
|
|
10
|
+
it('should display status badges via `expectedTargetPullRequests`', () => {
|
|
11
|
+
const commits = [
|
|
12
|
+
{
|
|
13
|
+
sha: 'ae9d51b7fe3ee6f30d0d196c782e0dcabb7ac5ff',
|
|
14
|
+
originalMessage: '[APM] Remove log-log descriptions from correlation charts (#119700)',
|
|
15
|
+
pullNumber: 119700,
|
|
16
|
+
expectedTargetPullRequests: [
|
|
17
|
+
{ number: 120178, branch: '8.0', state: 'MERGED' },
|
|
18
|
+
{ number: 120179, branch: '7.16', state: 'MERGED' },
|
|
19
|
+
{ number: 120179, branch: '7.15', state: 'MISSING' },
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
const choices = (0, prompts_1.getChoicesForCommitPrompt)(commits, false).map(({ name, short }) => ({ name: (0, strip_ansi_1.default)(name), short }));
|
|
24
|
+
expect(choices).toEqual([
|
|
25
|
+
{
|
|
26
|
+
name: '1. [APM] Remove log-log descriptions from correlation charts (#119700) 8.0, 7.16, 7.15',
|
|
27
|
+
short: '#119700 (ae9d51b7)',
|
|
28
|
+
},
|
|
29
|
+
]);
|
|
30
|
+
});
|
|
31
|
+
it('should list choices', () => {
|
|
32
|
+
const commits = [
|
|
33
|
+
{
|
|
34
|
+
committedDate: '',
|
|
35
|
+
sourceBranch: 'master',
|
|
36
|
+
sha: 'b1b491959dab47aeb83c88ee2accb2db46d23793',
|
|
37
|
+
originalMessage: '[APM] Prefer service.name for logs correlation (#120694)',
|
|
38
|
+
pullNumber: 120694,
|
|
39
|
+
expectedTargetPullRequests: [],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
committedDate: '',
|
|
43
|
+
sourceBranch: 'master',
|
|
44
|
+
sha: 'b1bb4a93959f19a653b9cfb207a5c6acb6559482',
|
|
45
|
+
originalMessage: '[APM] Disable telemetry in agent config endpoint (#120106)',
|
|
46
|
+
pullNumber: 120106,
|
|
47
|
+
expectedTargetPullRequests: [],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
committedDate: '',
|
|
51
|
+
sourceBranch: 'master',
|
|
52
|
+
sha: '434f6e6a88faf24dc1ea41f9f726db78e46355a7',
|
|
53
|
+
originalMessage: '[APM] Remove index_pattern.json and add custom field formatters (#119915)',
|
|
54
|
+
pullNumber: 119915,
|
|
55
|
+
expectedTargetPullRequests: [],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
committedDate: '',
|
|
59
|
+
sourceBranch: 'master',
|
|
60
|
+
sha: 'ae9d51b7fe3ee6f30d0d196c782e0dcabb7ac5ff',
|
|
61
|
+
originalMessage: '[APM] Remove log-log descriptions from correlation charts (#119700)',
|
|
62
|
+
pullNumber: 119700,
|
|
63
|
+
expectedTargetPullRequests: [],
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
const choices = (0, prompts_1.getChoicesForCommitPrompt)(commits, false).map(({ name, short }) => ({ name: (0, strip_ansi_1.default)(name), short }));
|
|
67
|
+
expect(choices).toEqual([
|
|
68
|
+
{
|
|
69
|
+
name: '1. [APM] Prefer service.name for logs correlation (#120694) ',
|
|
70
|
+
short: '#120694 (b1b49195)',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: '2. [APM] Disable telemetry in agent config endpoint (#120106) ',
|
|
74
|
+
short: '#120106 (b1bb4a93)',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: '3. [APM] Remove index_pattern.json and add custom field formatters (#119915) ',
|
|
78
|
+
short: '#119915 (434f6e6a)',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: '4. [APM] Remove log-log descriptions from correlation charts (#119700) ',
|
|
82
|
+
short: '#119700 (ae9d51b7)',
|
|
83
|
+
},
|
|
84
|
+
]);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Commit } from '
|
|
3
|
-
export declare function
|
|
1
|
+
import { TargetBranchChoice } from '../options/ConfigOptions';
|
|
2
|
+
import { Commit } from './sourceCommit/parseSourceCommit';
|
|
3
|
+
export declare function getChoicesForCommitPrompt(commits: Commit[], showDetails: boolean): {
|
|
4
|
+
name: string;
|
|
5
|
+
short: string;
|
|
6
|
+
value: Commit;
|
|
7
|
+
}[];
|
|
8
|
+
export declare function promptForCommits({ commitChoices, isMultipleChoice, showDetails, }: {
|
|
4
9
|
commitChoices: Commit[];
|
|
5
10
|
isMultipleChoice: boolean;
|
|
11
|
+
showDetails: boolean;
|
|
6
12
|
}): Promise<Commit[]>;
|
|
7
13
|
export declare function promptForTargetBranches({ targetBranchChoices, isMultipleChoice, }: {
|
|
8
|
-
targetBranchChoices:
|
|
14
|
+
targetBranchChoices: TargetBranchChoice[];
|
|
9
15
|
isMultipleChoice: boolean;
|
|
10
16
|
}): Promise<string[]>;
|
|
11
17
|
export declare function confirmPrompt(message: string): Promise<boolean>;
|