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.
Files changed (202) hide show
  1. package/dist/lib/child-process-promisified.js +2 -2
  2. package/dist/lib/git.js +1 -0
  3. package/dist/lib/git.test.js +26 -0
  4. package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +1 -0
  5. package/dist/options/ConfigOptions.d.ts +1 -0
  6. package/dist/options/cliArgs.d.ts +1 -0
  7. package/dist/options/cliArgs.js +5 -0
  8. package/dist/options/config/config.d.ts +1 -0
  9. package/dist/options/config/readConfigFile.d.ts +1 -0
  10. package/dist/options/options.d.ts +2 -0
  11. package/dist/options/options.js +1 -0
  12. package/dist/options/options.test.js +1 -0
  13. package/dist/test/e2e/cli/entrypoint.cli.private.test.js +2 -0
  14. package/dist/utils/packageVersion.d.ts +1 -1
  15. package/dist/utils/packageVersion.js +1 -1
  16. package/package.json +3 -4
  17. package/dist/entrypoint.cli.private.test.d.ts +0 -1
  18. package/dist/entrypoint.cli.private.test.js +0 -47
  19. package/dist/errors/BackportError.d.ts +0 -19
  20. package/dist/errors/BackportError.js +0 -29
  21. package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.d.ts +0 -1
  22. package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.js +0 -112
  23. package/dist/runSequentially.test.d.ts +0 -1
  24. package/dist/runSequentially.test.js +0 -243
  25. package/dist/services/BackportError.d.ts +0 -19
  26. package/dist/services/BackportError.js +0 -29
  27. package/dist/services/HandledBackportError.d.ts +0 -19
  28. package/dist/services/HandledBackportError.js +0 -29
  29. package/dist/services/HandledError.d.ts +0 -19
  30. package/dist/services/HandledError.js +0 -29
  31. package/dist/services/child-process-promisified.d.ts +0 -25
  32. package/dist/services/child-process-promisified.js +0 -58
  33. package/dist/services/env.d.ts +0 -7
  34. package/dist/services/env.js +0 -30
  35. package/dist/services/env.test.d.ts +0 -1
  36. package/dist/services/env.test.js +0 -21
  37. package/dist/services/git.d.ts +0 -77
  38. package/dist/services/git.integration.test.d.ts +0 -1
  39. package/dist/services/git.integration.test.js +0 -616
  40. package/dist/services/git.js +0 -439
  41. package/dist/services/git.private.test.d.ts +0 -1
  42. package/dist/services/git.private.test.js +0 -618
  43. package/dist/services/git.test.d.ts +0 -1
  44. package/dist/services/git.test.js +0 -580
  45. package/dist/services/github/commitFormatters.d.ts +0 -3
  46. package/dist/services/github/commitFormatters.js +0 -17
  47. package/dist/services/github/commitFormatters.test.d.ts +0 -1
  48. package/dist/services/github/commitFormatters.test.js +0 -11
  49. package/dist/services/github/v3/addAssigneesToPullRequest.d.ts +0 -2
  50. package/dist/services/github/v3/addAssigneesToPullRequest.js +0 -32
  51. package/dist/services/github/v3/addAssigneesToPullRequest.test.d.ts +0 -1
  52. package/dist/services/github/v3/addAssigneesToPullRequest.test.js +0 -27
  53. package/dist/services/github/v3/addLabelsToPullRequest.d.ts +0 -2
  54. package/dist/services/github/v3/addLabelsToPullRequest.js +0 -30
  55. package/dist/services/github/v3/addReviewersToPullRequest.d.ts +0 -2
  56. package/dist/services/github/v3/addReviewersToPullRequest.js +0 -32
  57. package/dist/services/github/v3/createPullRequest.d.ts +0 -29
  58. package/dist/services/github/v3/createPullRequest.js +0 -91
  59. package/dist/services/github/v3/createPullRequest.test.d.ts +0 -1
  60. package/dist/services/github/v3/createPullRequest.test.js +0 -377
  61. package/dist/services/github/v3/createStatusComment.d.ts +0 -11
  62. package/dist/services/github/v3/createStatusComment.js +0 -131
  63. package/dist/services/github/v3/createStatusComment.test.d.ts +0 -1
  64. package/dist/services/github/v3/createStatusComment.test.js +0 -409
  65. package/dist/services/github/v3/getGithubV3ErrorMessage.d.ts +0 -14
  66. package/dist/services/github/v3/getGithubV3ErrorMessage.js +0 -16
  67. package/dist/services/github/v4/FetchPullRequestId.d.ts +0 -2
  68. package/dist/services/github/v4/FetchPullRequestId.js +0 -36
  69. package/dist/services/github/v4/apiRequestV4.d.ts +0 -31
  70. package/dist/services/github/v4/apiRequestV4.js +0 -71
  71. package/dist/services/github/v4/apiRequestV4.test.d.ts +0 -1
  72. package/dist/services/github/v4/apiRequestV4.test.js +0 -109
  73. package/dist/services/github/v4/disablePullRequestAutoMerge.d.ts +0 -2
  74. package/dist/services/github/v4/disablePullRequestAutoMerge.js +0 -32
  75. package/dist/services/github/v4/enablePullRequestAutoMerge.d.ts +0 -2
  76. package/dist/services/github/v4/enablePullRequestAutoMerge.js +0 -50
  77. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.d.ts +0 -1
  78. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +0 -112
  79. package/dist/services/github/v4/fetchAuthorId.d.ts +0 -10
  80. package/dist/services/github/v4/fetchAuthorId.js +0 -28
  81. package/dist/services/github/v4/fetchAuthorId.private.test.d.ts +0 -1
  82. package/dist/services/github/v4/fetchAuthorId.private.test.js +0 -25
  83. package/dist/services/github/v4/fetchCommits/allFetchers.private.test.d.ts +0 -1
  84. package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +0 -93
  85. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +0 -11
  86. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +0 -58
  87. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +0 -1
  88. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +0 -136
  89. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.d.ts +0 -11
  90. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +0 -48
  91. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +0 -1
  92. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +0 -118
  93. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +0 -29
  94. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +0 -110
  95. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +0 -1
  96. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +0 -196
  97. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +0 -1
  98. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +0 -157
  99. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +0 -3
  100. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +0 -61
  101. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
  102. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +0 -107
  103. package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.d.ts +0 -12
  104. package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +0 -69
  105. package/dist/services/github/v4/fetchExistingPullRequest.d.ts +0 -9
  106. package/dist/services/github/v4/fetchExistingPullRequest.js +0 -64
  107. package/dist/services/github/v4/fetchExistingPullRequest.private.test.d.ts +0 -1
  108. package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +0 -44
  109. package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +0 -2
  110. package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.js +0 -39
  111. package/dist/services/github/v4/fetchRemoteProjectConfig.d.ts +0 -8
  112. package/dist/services/github/v4/fetchRemoteProjectConfig.js +0 -49
  113. package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.d.ts +0 -1
  114. package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +0 -49
  115. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +0 -69
  116. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +0 -73
  117. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +0 -1
  118. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +0 -116
  119. package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +0 -16
  120. package/dist/services/github/v4/getOptionsFromGithub/query.js +0 -29
  121. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +0 -29
  122. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.js +0 -61
  123. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.d.ts +0 -1
  124. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +0 -72
  125. package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +0 -2
  126. package/dist/services/github/v4/mocks/commitsByAuthorMock.js +0 -176
  127. package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +0 -6
  128. package/dist/services/github/v4/throwOnInvalidAccessToken.js +0 -45
  129. package/dist/services/github/v4/throwOnInvalidAccessToken.test.d.ts +0 -1
  130. package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +0 -87
  131. package/dist/services/logger.d.ts +0 -9
  132. package/dist/services/logger.js +0 -74
  133. package/dist/services/prompt.test.d.ts +0 -1
  134. package/dist/services/prompt.test.js +0 -139
  135. package/dist/services/prompts.d.ts +0 -17
  136. package/dist/services/prompts.js +0 -132
  137. package/dist/services/remoteConfig.d.ts +0 -20
  138. package/dist/services/remoteConfig.js +0 -52
  139. package/dist/services/sequentially.d.ts +0 -1
  140. package/dist/services/sequentially.js +0 -10
  141. package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +0 -16
  142. package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +0 -102
  143. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +0 -1
  144. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +0 -467
  145. package/dist/services/sourceCommit/getMockSourceCommit.d.ts +0 -26
  146. package/dist/services/sourceCommit/getMockSourceCommit.js +0 -103
  147. package/dist/services/sourceCommit/parseSourceCommit.d.ts +0 -108
  148. package/dist/services/sourceCommit/parseSourceCommit.js +0 -123
  149. package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +0 -1
  150. package/dist/services/sourceCommit/parseSourceCommit.test.js +0 -226
  151. package/dist/services/test.d.ts +0 -1
  152. package/dist/services/test.js +0 -23
  153. package/dist/state.d.ts +0 -0
  154. package/dist/state.js +0 -1
  155. package/dist/test/ExecError.d.ts +0 -16
  156. package/dist/test/ExecError.js +0 -15
  157. package/dist/test/e2e/cli/cli.private.test.d.ts +0 -1
  158. package/dist/test/e2e/cli/cli.private.test.js +0 -222
  159. package/dist/test/e2e/cli/date-filters.d.ts +0 -1
  160. package/dist/test/e2e/cli/date-filters.js +0 -43
  161. package/dist/test/e2e/cli/interactive-error-handling.private.test.d.ts +0 -1
  162. package/dist/test/e2e/cli/interactive-error-handling.private.test.js +0 -80
  163. package/dist/test/e2e/cli/non-interactive-error-handling.private.test.d.ts +0 -1
  164. package/dist/test/e2e/cli/non-interactive-error-handling.private.test.js +0 -198
  165. package/dist/test/e2e/cli.e2e.private.test.d.ts +0 -1
  166. package/dist/test/e2e/cli.e2e.private.test.js +0 -433
  167. package/dist/test/e2e/module/module.mutation.test.d.ts +0 -1
  168. package/dist/test/e2e/module/module.mutation.test.js +0 -369
  169. package/dist/test/e2e/module.e2e.mutation.test.d.ts +0 -1
  170. package/dist/test/e2e/module.e2e.mutation.test.js +0 -369
  171. package/dist/test/e2e/module.e2e.private.test.d.ts +0 -1
  172. package/dist/test/e2e/module.e2e.private.test.js +0 -369
  173. package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +0 -13
  174. package/dist/ui/cherrypickAndCreateTargetPullRequest.js +0 -243
  175. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
  176. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +0 -320
  177. package/dist/ui/getCommits.d.ts +0 -2
  178. package/dist/ui/getCommits.js +0 -75
  179. package/dist/ui/getCommitsWithoutBackports.d.ts +0 -11
  180. package/dist/ui/getCommitsWithoutBackports.js +0 -68
  181. package/dist/ui/getCommitsWithoutBackports.test.d.ts +0 -1
  182. package/dist/ui/getCommitsWithoutBackports.test.js +0 -335
  183. package/dist/ui/getGitConfigAuthor.d.ts +0 -6
  184. package/dist/ui/getGitConfigAuthor.js +0 -15
  185. package/dist/ui/getTargetBranches.d.ts +0 -5
  186. package/dist/ui/getTargetBranches.js +0 -67
  187. package/dist/ui/getTargetBranches.test.d.ts +0 -1
  188. package/dist/ui/getTargetBranches.test.js +0 -204
  189. package/dist/ui/maybeSetupRepo.d.ts +0 -2
  190. package/dist/ui/maybeSetupRepo.js +0 -53
  191. package/dist/ui/maybeSetupRepo.test.d.ts +0 -1
  192. package/dist/ui/maybeSetupRepo.test.js +0 -238
  193. package/dist/ui/ora.d.ts +0 -2
  194. package/dist/ui/ora.js +0 -21
  195. package/dist/ui/setupRepo.d.ts +0 -2
  196. package/dist/ui/setupRepo.js +0 -56
  197. package/dist/ui/setupRepo.test.d.ts +0 -1
  198. package/dist/ui/setupRepo.test.js +0 -273
  199. package/dist/utils/filterMissingCommits.d.ts +0 -2
  200. package/dist/utils/filterMissingCommits.js +0 -7
  201. package/dist/utils/redact.d.ts +0 -1
  202. package/dist/utils/redact.js +0 -7
@@ -1,108 +0,0 @@
1
- import { ValidConfigOptions } from '../../options/options';
2
- import { RemoteConfigHistory } from '../remoteConfig';
3
- import { ExpectedTargetPullRequest } from './getExpectedTargetPullRequests';
4
- export interface Commit {
5
- author: SourceCommitWithTargetPullRequest['author'];
6
- sourceCommit: {
7
- committedDate: string;
8
- message: string;
9
- sha: string;
10
- };
11
- sourcePullRequest?: {
12
- number: number;
13
- url: string;
14
- mergeCommit: {
15
- message: string;
16
- sha: string;
17
- };
18
- };
19
- sourceBranch: string;
20
- expectedTargetPullRequests: ExpectedTargetPullRequest[];
21
- }
22
- export interface SourcePullRequestNode {
23
- baseRefName: string;
24
- url: string;
25
- number: number;
26
- labels: {
27
- nodes: {
28
- name: string;
29
- }[];
30
- };
31
- mergeCommit: {
32
- remoteConfigHistory: RemoteConfigHistory['remoteConfigHistory'];
33
- sha: string;
34
- message: string;
35
- };
36
- timelineItems: {
37
- edges: TimelineEdge[];
38
- };
39
- }
40
- export declare type TimelineEdge = TimelinePullRequestEdge | TimelineIssueEdge;
41
- export interface TimelinePullRequestEdge {
42
- node: {
43
- targetPullRequest: {
44
- __typename: 'PullRequest';
45
- url: string;
46
- title: string;
47
- state: 'OPEN' | 'CLOSED' | 'MERGED';
48
- baseRefName: string;
49
- number: number;
50
- targetMergeCommit: {
51
- sha: string;
52
- message: string;
53
- } | null;
54
- repository: {
55
- name: string;
56
- owner: {
57
- login: string;
58
- };
59
- };
60
- commits: {
61
- edges: Array<{
62
- node: {
63
- targetCommit: {
64
- message: string;
65
- sha: string;
66
- };
67
- };
68
- }>;
69
- };
70
- };
71
- };
72
- }
73
- interface TimelineIssueEdge {
74
- node: {
75
- targetPullRequest: {
76
- __typename: 'Issue';
77
- };
78
- };
79
- }
80
- export declare type SourceCommitWithTargetPullRequest = {
81
- repository: {
82
- name: string;
83
- owner: {
84
- login: string;
85
- };
86
- };
87
- sha: string;
88
- message: string;
89
- committedDate: string;
90
- author: {
91
- name: string;
92
- email: string;
93
- };
94
- associatedPullRequests: {
95
- edges: {
96
- node: SourcePullRequestNode;
97
- }[] | null;
98
- };
99
- };
100
- export declare function parseSourceCommit({ sourceCommit, options, }: {
101
- sourceCommit: SourceCommitWithTargetPullRequest;
102
- options: {
103
- branchLabelMapping?: ValidConfigOptions['branchLabelMapping'];
104
- sourceBranch: string;
105
- };
106
- }): Commit;
107
- export declare const SourceCommitWithTargetPullRequestFragment: import("graphql").DocumentNode;
108
- export {};
@@ -1,123 +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.SourceCommitWithTargetPullRequestFragment = exports.parseSourceCommit = void 0;
7
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
- const remoteConfig_1 = require("../remoteConfig");
9
- const getExpectedTargetPullRequests_1 = require("./getExpectedTargetPullRequests");
10
- function parseSourceCommit({ sourceCommit, options, }) {
11
- const sourcePullRequest = sourceCommit.associatedPullRequests.edges?.[0]?.node;
12
- return {
13
- author: sourceCommit.author,
14
- sourceCommit: {
15
- committedDate: sourceCommit.committedDate,
16
- message: sourceCommit.message,
17
- sha: sourceCommit.sha,
18
- },
19
- sourcePullRequest: sourcePullRequest
20
- ? {
21
- number: sourcePullRequest.number,
22
- url: sourcePullRequest.url,
23
- mergeCommit: {
24
- message: sourcePullRequest.mergeCommit.message,
25
- sha: sourcePullRequest.mergeCommit.sha,
26
- },
27
- }
28
- : undefined,
29
- sourceBranch: sourcePullRequest?.baseRefName ?? options.sourceBranch,
30
- expectedTargetPullRequests: (0, getExpectedTargetPullRequests_1.getExpectedTargetPullRequests)({
31
- sourceCommit,
32
- latestBranchLabelMapping: options.branchLabelMapping,
33
- }),
34
- };
35
- }
36
- exports.parseSourceCommit = parseSourceCommit;
37
- exports.SourceCommitWithTargetPullRequestFragment = (0, graphql_tag_1.default) `
38
- fragment SourceCommitWithTargetPullRequestFragment on Commit {
39
- # Source Commit
40
- repository {
41
- name
42
- owner {
43
- login
44
- }
45
- }
46
- sha: oid
47
- message
48
- committedDate
49
-
50
- author {
51
- name
52
- email
53
- }
54
-
55
- # Source pull request: PR where source commit was merged in
56
- associatedPullRequests(first: 1) {
57
- edges {
58
- node {
59
- url
60
- number
61
- labels(first: 50) {
62
- nodes {
63
- name
64
- }
65
- }
66
- baseRefName
67
-
68
- # source merge commit (the commit that actually went into the source branch)
69
- mergeCommit {
70
- ...RemoteConfigHistoryFragment
71
- sha: oid
72
- message
73
- }
74
-
75
- # (possible) backport pull requests referenced in the source pull request
76
- timelineItems(last: 20, itemTypes: CROSS_REFERENCED_EVENT) {
77
- edges {
78
- node {
79
- ... on CrossReferencedEvent {
80
- targetPullRequest: source {
81
- __typename
82
-
83
- # Target PRs (backport PRs)
84
- ... on PullRequest {
85
- # target merge commit: the backport commit that was merged into the target branch
86
- targetMergeCommit: mergeCommit {
87
- sha: oid
88
- message
89
- }
90
- repository {
91
- name
92
- owner {
93
- login
94
- }
95
- }
96
- url
97
- title
98
- state
99
- baseRefName
100
- number
101
- commits(first: 20) {
102
- edges {
103
- node {
104
- targetCommit: commit {
105
- message
106
- sha: oid
107
- }
108
- }
109
- }
110
- }
111
- }
112
- }
113
- }
114
- }
115
- }
116
- }
117
- }
118
- }
119
- }
120
- }
121
-
122
- ${remoteConfig_1.RemoteConfigHistoryFragment}
123
- `;
@@ -1,226 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const getMockSourceCommit_1 = require("./getMockSourceCommit");
4
- const parseSourceCommit_1 = require("./parseSourceCommit");
5
- describe('parseSourceCommit', () => {
6
- describe('pullNumber', () => {
7
- it('receives `pullNumber` from the associated pull request', () => {
8
- const mockSourceCommit = (0, getMockSourceCommit_1.getMockSourceCommit)({
9
- sourceCommit: { message: 'My commit message (#1234)' },
10
- sourcePullRequest: { number: 55 },
11
- });
12
- const commit = (0, parseSourceCommit_1.parseSourceCommit)({
13
- sourceCommit: mockSourceCommit,
14
- options: {},
15
- });
16
- expect(commit.sourcePullRequest?.number).toBe(55);
17
- });
18
- });
19
- describe('sourceBranch', () => {
20
- it('sets sourceBranch based on `baseRefName` from associated PR', () => {
21
- const mockSourceCommit = (0, getMockSourceCommit_1.getMockSourceCommit)({
22
- sourceCommit: { message: 'My commit message (#66)' },
23
- sourcePullRequest: { number: 55, sourceBranch: 'a sourcebranch' },
24
- });
25
- const commit = (0, parseSourceCommit_1.parseSourceCommit)({
26
- sourceCommit: mockSourceCommit,
27
- options: {},
28
- });
29
- expect(commit.sourceBranch).toBe('a sourcebranch');
30
- });
31
- it('sets uses options.sourceBranch as fallback', () => {
32
- const mockSourceCommit = (0, getMockSourceCommit_1.getMockSourceCommit)({
33
- sourceCommit: { message: 'My commit message (#66)' },
34
- sourcePullRequest: null,
35
- });
36
- const commit = (0, parseSourceCommit_1.parseSourceCommit)({
37
- sourceCommit: mockSourceCommit,
38
- options: {
39
- sourceBranch: 'sourcebranch-from-options',
40
- },
41
- });
42
- expect(commit.sourceBranch).toBe('sourcebranch-from-options');
43
- });
44
- });
45
- describe('expectedTargetPullRequests', () => {
46
- it('uses options.branchLabelMapping when historicalBranchLabelMappings is empty', () => {
47
- const mockSourceCommit = (0, getMockSourceCommit_1.getMockSourceCommit)({
48
- sourceCommit: {
49
- message: 'My commit message (#66)',
50
- commitedDate: '2021-03-03T00:00:00Z',
51
- },
52
- sourcePullRequest: {
53
- sourceBranch: 'main',
54
- number: 55,
55
- labels: ['v6.4.0', 'v6.3.0', 'v6.2.0', 'v6.1.0'],
56
- },
57
- timelineItems: [
58
- {
59
- state: 'MERGED',
60
- targetBranch: '6.3',
61
- commitMessages: ['My commit message (#66)'],
62
- number: 5678,
63
- },
64
- {
65
- state: 'OPEN',
66
- targetBranch: '6.2',
67
- commitMessages: ['My commit message (#66)'],
68
- number: 9876,
69
- },
70
- ],
71
- });
72
- const commit = (0, parseSourceCommit_1.parseSourceCommit)({
73
- sourceCommit: mockSourceCommit,
74
- options: {
75
- branchLabelMapping: {
76
- '^v6.4.0$': 'main',
77
- '^v(\\d+).(\\d+).\\d+$': '$1.$2',
78
- },
79
- },
80
- });
81
- expect(commit.expectedTargetPullRequests).toEqual([
82
- {
83
- branch: '6.3',
84
- number: 5678,
85
- state: 'MERGED',
86
- url: 'https://github.com/elastic/kibana/pull/5678',
87
- mergeCommit: {
88
- message: 'My commit message (#66)',
89
- sha: 'target-merge-commit-sha',
90
- },
91
- },
92
- {
93
- branch: '6.2',
94
- number: 9876,
95
- state: 'OPEN',
96
- url: 'https://github.com/elastic/kibana/pull/9876',
97
- },
98
- {
99
- branch: '6.1',
100
- state: 'NOT_CREATED',
101
- },
102
- ]);
103
- });
104
- it('uses the historical branchLabelMapping from 2021-02-02', () => {
105
- const mockSourceCommit = (0, getMockSourceCommit_1.getMockSourceCommit)({
106
- sourceCommit: {
107
- remoteConfig: {
108
- branchLabelMapping: {
109
- '^v6.3.0$': 'main',
110
- '^v(\\d+).(\\d+).\\d+$': '$1.$2',
111
- },
112
- committedDate: '2021-02-02T00:00:00Z',
113
- },
114
- message: 'My commit message (#66)',
115
- commitedDate: '2021-03-03T00:00:00Z',
116
- },
117
- sourcePullRequest: {
118
- sourceBranch: 'main',
119
- number: 55,
120
- labels: ['v6.3.0', 'v6.2.0', 'v6.1.0'],
121
- },
122
- timelineItems: [
123
- {
124
- state: 'OPEN',
125
- targetBranch: '6.2',
126
- commitMessages: ['My commit message (#66)'],
127
- number: 9876,
128
- },
129
- ],
130
- });
131
- const commit = (0, parseSourceCommit_1.parseSourceCommit)({
132
- sourceCommit: mockSourceCommit,
133
- options: {
134
- branchLabelMapping: {
135
- '^v6.4.0$': 'main',
136
- '^v(\\d+).(\\d+).\\d+$': '$1.$2',
137
- },
138
- },
139
- });
140
- expect(commit.expectedTargetPullRequests).toEqual([
141
- {
142
- branch: '6.2',
143
- number: 9876,
144
- state: 'OPEN',
145
- url: 'https://github.com/elastic/kibana/pull/9876',
146
- },
147
- {
148
- branch: '6.1',
149
- state: 'NOT_CREATED',
150
- },
151
- ]);
152
- });
153
- });
154
- it('returns the correct source commit', () => {
155
- const mockSourceCommit = (0, getMockSourceCommit_1.getMockSourceCommit)({
156
- sourceCommit: { message: 'My commit message (#1234)', sha: 'my-sha' },
157
- sourcePullRequest: {
158
- number: 1234,
159
- labels: ['v6.3.0', 'v6.2.0', 'v6.1.0'],
160
- },
161
- timelineItems: [
162
- {
163
- state: 'MERGED',
164
- targetBranch: '6.x',
165
- commitMessages: ['My commit message (#1234)'],
166
- number: 5678,
167
- },
168
- {
169
- state: 'OPEN',
170
- targetBranch: '6.2',
171
- commitMessages: ['My commit message (#1234)'],
172
- number: 9876,
173
- },
174
- ],
175
- });
176
- const commit = (0, parseSourceCommit_1.parseSourceCommit)({
177
- sourceCommit: mockSourceCommit,
178
- options: {
179
- branchLabelMapping: {
180
- '^v6.3.0$': '6.x',
181
- '^v(\\d+).(\\d+).\\d+$': '$1.$2',
182
- },
183
- },
184
- });
185
- const expectedCommit = {
186
- author: { email: 'soren.louv@elastic.co', name: 'Søren Louv-Jansen' },
187
- sourceCommit: {
188
- committedDate: '2021-12-22T00:00:00Z',
189
- message: 'My commit message (#1234)',
190
- sha: 'my-sha',
191
- },
192
- sourcePullRequest: {
193
- number: 1234,
194
- url: 'https://github.com/elastic/kibana/pull/1234',
195
- mergeCommit: {
196
- message: 'My commit message (#1234)',
197
- sha: 'my-sha',
198
- },
199
- },
200
- sourceBranch: 'source-branch-from-associated-pull-request',
201
- expectedTargetPullRequests: [
202
- {
203
- branch: '6.x',
204
- number: 5678,
205
- state: 'MERGED',
206
- url: 'https://github.com/elastic/kibana/pull/5678',
207
- mergeCommit: {
208
- message: 'My commit message (#1234)',
209
- sha: 'target-merge-commit-sha',
210
- },
211
- },
212
- {
213
- branch: '6.2',
214
- number: 9876,
215
- state: 'OPEN',
216
- url: 'https://github.com/elastic/kibana/pull/9876',
217
- },
218
- {
219
- branch: '6.1',
220
- state: 'NOT_CREATED',
221
- },
222
- ],
223
- };
224
- expect(commit).toEqual(expectedCommit);
225
- });
226
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const promises_1 = require("fs/promises");
4
- async function init() {
5
- try {
6
- await (0, promises_1.writeFile)('foo.txt', 'foo', {
7
- flag: 'wx',
8
- mode: 0o600, // give the owner read-write privleges, no access for others
9
- });
10
- }
11
- catch (e) {
12
- const a = e instanceof Error;
13
- console.log(a);
14
- console.log(e.constructor.name);
15
- if (isErrnoError(e)) {
16
- console.log(e.path);
17
- }
18
- }
19
- }
20
- init();
21
- function isErrnoError(error) {
22
- return error instanceof Error && 'code' in error;
23
- }
package/dist/state.d.ts DELETED
File without changes
package/dist/state.js DELETED
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,16 +0,0 @@
1
- /// <reference types="node" />
2
- import { SignalConstants } from 'os';
3
- export declare class ExecError extends Error {
4
- code: number | undefined;
5
- cmd: string | undefined;
6
- stdout: string | undefined;
7
- stderr: string | undefined;
8
- constructor(error: {
9
- cmd?: string;
10
- killed?: boolean;
11
- code?: number;
12
- signal?: SignalConstants | null;
13
- stdout?: string;
14
- stderr?: string;
15
- });
16
- }
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExecError = void 0;
4
- class ExecError extends Error {
5
- constructor(error) {
6
- super(error.stderr);
7
- this.name = 'ExecError';
8
- this.code = error.code;
9
- this.cmd = error.cmd;
10
- this.stdout = error.stdout;
11
- this.stderr = error.stderr;
12
- Error.captureStackTrace(this, ExecError);
13
- }
14
- }
15
- exports.ExecError = ExecError;
@@ -1 +0,0 @@
1
- export {};