backport 6.2.1 → 6.3.0-beta

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 (370) hide show
  1. package/README.md +13 -5
  2. package/dist/backportRun.d.ts +2 -2
  3. package/dist/backportRun.js +11 -7
  4. package/dist/entrypoint.cli.js +0 -0
  5. package/dist/entrypoint.module.js +1 -1
  6. package/dist/options/ConfigOptions.d.ts +2 -0
  7. package/dist/options/cliArgs.js +3 -2
  8. package/dist/options/config/config.d.ts +2 -0
  9. package/dist/options/config/config.js +2 -7
  10. package/dist/options/config/globalConfig.js +3 -3
  11. package/dist/options/config/readConfigFile.d.ts +2 -0
  12. package/dist/options/config/readConfigFile.js +2 -2
  13. package/dist/options/options.d.ts +4 -27
  14. package/dist/options/options.js +37 -29
  15. package/dist/runSequentially.d.ts +0 -1
  16. package/dist/runSequentially.js +0 -1
  17. package/dist/services/HandledError.d.ts +6 -4
  18. package/dist/services/HandledError.js +18 -3
  19. package/dist/services/child-process-promisified.d.ts +3 -1
  20. package/dist/services/git.d.ts +22 -9
  21. package/dist/services/git.js +66 -54
  22. package/dist/services/github/commitFormatters.d.ts +0 -1
  23. package/dist/services/github/commitFormatters.js +1 -8
  24. package/dist/services/github/v3/createPullRequest.js +8 -5
  25. package/dist/services/github/v3/createStatusComment.js +26 -15
  26. package/dist/services/github/v3/getGithubV3ErrorMessage.d.ts +2 -1
  27. package/dist/services/github/v4/FetchPullRequestId.d.ts +0 -7
  28. package/dist/services/github/v4/apiRequestV4.d.ts +21 -17
  29. package/dist/services/github/v4/apiRequestV4.js +38 -28
  30. package/dist/services/github/v4/disablePullRequestAutoMerge.d.ts +0 -7
  31. package/dist/services/github/v4/enablePullRequestAutoMerge.d.ts +0 -7
  32. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -3
  33. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +2 -2
  34. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +1 -8
  35. package/dist/services/github/v4/fetchExistingPullRequest.d.ts +0 -4
  36. package/dist/services/github/v4/fetchExistingPullRequest.js +1 -2
  37. package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +0 -9
  38. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +3 -1
  39. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +38 -32
  40. package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +2 -1
  41. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +29 -0
  42. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.js +56 -0
  43. package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +4 -5
  44. package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -7
  45. package/dist/services/logger.d.ts +6 -3
  46. package/dist/services/logger.js +11 -7
  47. package/dist/services/prompts.js +12 -10
  48. package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +1 -1
  49. package/dist/services/sourceCommit/getMockSourceCommit.js +6 -6
  50. package/dist/services/sourceCommit/parseSourceCommit.d.ts +18 -10
  51. package/dist/services/sourceCommit/parseSourceCommit.js +20 -14
  52. package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +0 -1
  53. package/dist/ui/cherrypickAndCreateTargetPullRequest.js +12 -13
  54. package/dist/ui/getCommits.js +8 -14
  55. package/dist/ui/getCommitsWithoutBackports.js +6 -6
  56. package/dist/ui/getTargetBranches.js +1 -1
  57. package/dist/ui/maybeSetupRepo.js +25 -5
  58. package/dist/utils/maybe.d.ts +1 -0
  59. package/dist/utils/maybe.js +7 -0
  60. package/dist/utils/packageVersion.d.ts +1 -0
  61. package/dist/{types/PromiseReturnType.js → utils/packageVersion.js} +2 -0
  62. package/package.json +22 -18
  63. package/yarn.lock +114 -147
  64. package/dist/entrypoint.api.d.ts +0 -22
  65. package/dist/entrypoint.api.js +0 -57
  66. package/dist/entrypoint.api.private.test.d.ts +0 -1
  67. package/dist/entrypoint.api.private.test.js +0 -37
  68. package/dist/entrypoint.module.private.test.d.ts +0 -1
  69. package/dist/entrypoint.module.private.test.js +0 -37
  70. package/dist/index.d.ts +0 -783
  71. package/dist/index.js +0 -8001
  72. package/dist/ink.d.ts +0 -1
  73. package/dist/ink.js +0 -49
  74. package/dist/main.d.ts +0 -14
  75. package/dist/main.js +0 -68
  76. package/dist/options/cliArgs.test.d.ts +0 -1
  77. package/dist/options/cliArgs.test.js +0 -152
  78. package/dist/options/config/config.test.d.ts +0 -1
  79. package/dist/options/config/config.test.js +0 -48
  80. package/dist/options/config/getOptionsFromGit.d.ts +0 -4
  81. package/dist/options/config/getOptionsFromGit.js +0 -8
  82. package/dist/options/config/getProjectConfig.d.ts +0 -0
  83. package/dist/options/config/getProjectConfig.js +0 -1
  84. package/dist/options/config/globalConfig.test.d.ts +0 -1
  85. package/dist/options/config/globalConfig.test.js +0 -80
  86. package/dist/options/config/projectConfig.test.d.ts +0 -1
  87. package/dist/options/config/projectConfig.test.js +0 -128
  88. package/dist/options/getValidatedOptions.d.ts +0 -49
  89. package/dist/options/getValidatedOptions.js +0 -45
  90. package/dist/options/getValidatedOptions.test.d.ts +0 -1
  91. package/dist/options/getValidatedOptions.test.js +0 -97
  92. package/dist/options/options.test.d.ts +0 -1
  93. package/dist/options/options.test.js +0 -338
  94. package/dist/options/parseRequiredOptions.d.ts +0 -71
  95. package/dist/options/parseRequiredOptions.js +0 -68
  96. package/dist/options/parseRequiredOptions.test.d.ts +0 -1
  97. package/dist/options/parseRequiredOptions.test.js +0 -122
  98. package/dist/react-components/0-loadOptions.d.ts +0 -6
  99. package/dist/react-components/0-loadOptions.js +0 -45
  100. package/dist/react-components/1-loadCommit.d.ts +0 -8
  101. package/dist/react-components/1-loadCommit.js +0 -88
  102. package/dist/react-components/1a-loadCommit.d.ts +0 -5
  103. package/dist/react-components/1a-loadCommit.js +0 -76
  104. package/dist/react-components/1b-commitChoices.d.ts +0 -5
  105. package/dist/react-components/1b-commitChoices.js +0 -98
  106. package/dist/react-components/2-commitChoices.d.ts +0 -8
  107. package/dist/react-components/2-commitChoices.js +0 -96
  108. package/dist/react-components/2-commitsPrompt.d.ts +0 -8
  109. package/dist/react-components/2-commitsPrompt.js +0 -96
  110. package/dist/react-components/2-targetBranchChoices.d.ts +0 -9
  111. package/dist/react-components/2-targetBranchChoices.js +0 -109
  112. package/dist/react-components/3-cherrypick.d.ts +0 -1
  113. package/dist/react-components/3-cherrypick.js +0 -2
  114. package/dist/react-components/App.d.ts +0 -2
  115. package/dist/react-components/App.js +0 -35
  116. package/dist/react-components/BackportStateContext.d.ts +0 -33
  117. package/dist/react-components/BackportStateContext.js +0 -42
  118. package/dist/react-components/CommitPrompt/2-commitsPrompt.d.ts +0 -8
  119. package/dist/react-components/CommitPrompt/2-commitsPrompt.js +0 -96
  120. package/dist/react-components/CommitPrompt/CommitPrompt.d.ts +0 -8
  121. package/dist/react-components/CommitPrompt/CommitPrompt.js +0 -96
  122. package/dist/react-components/CommitPrompt/getCommits.d.ts +0 -2
  123. package/dist/react-components/CommitPrompt/getCommits.js +0 -27
  124. package/dist/react-components/CommitPrompt.d.ts +0 -8
  125. package/dist/react-components/CommitPrompt.js +0 -96
  126. package/dist/react-components/CustomMultiSelect.d.ts +0 -13
  127. package/dist/react-components/CustomMultiSelect.js +0 -21
  128. package/dist/react-components/CustomMultiSelectItem.d.ts +0 -5
  129. package/dist/react-components/CustomMultiSelectItem.js +0 -12
  130. package/dist/react-components/CustomSelect.d.ts +0 -14
  131. package/dist/react-components/CustomSelect.js +0 -34
  132. package/dist/react-components/ErrorBoundary.d.ts +0 -15
  133. package/dist/react-components/ErrorBoundary.js +0 -53
  134. package/dist/react-components/MultiSelect.d.ts +0 -7
  135. package/dist/react-components/MultiSelect.js +0 -16
  136. package/dist/react-components/hooks/useAsync.d.ts +0 -12
  137. package/dist/react-components/hooks/useAsync.js +0 -73
  138. package/dist/runSequentially.test.d.ts +0 -1
  139. package/dist/runSequentially.test.js +0 -195
  140. package/dist/runWithOptions.d.ts +0 -9
  141. package/dist/runWithOptions.js +0 -43
  142. package/dist/runWithOptions.test.d.ts +0 -1
  143. package/dist/runWithOptions.test.js +0 -304
  144. package/dist/scripts/generate-gql.d.ts +0 -1
  145. package/dist/scripts/generate-gql.js +0 -15
  146. package/dist/scripts/postinstall.test.d.ts +0 -1
  147. package/dist/scripts/postinstall.test.js +0 -53
  148. package/dist/services/backportRun/backportRun.ci.d.ts +0 -6
  149. package/dist/services/backportRun/backportRun.ci.js +0 -81
  150. package/dist/services/backportRun/backportRun.d.ts +0 -14
  151. package/dist/services/backportRun/backportRun.interactive.d.ts +0 -1
  152. package/dist/services/backportRun/backportRun.interactive.js +0 -4
  153. package/dist/services/backportRun/backportRun.js +0 -14
  154. package/dist/services/backportRun/backportState.d.ts +0 -4
  155. package/dist/services/backportRun/backportState.js +0 -28
  156. package/dist/services/backportRun/getCommits.d.ts +0 -2
  157. package/dist/services/backportRun/getCommits.js +0 -20
  158. package/dist/services/backportRun/runSequentially.d.ts +0 -20
  159. package/dist/services/backportRun/runSequentially.js +0 -41
  160. package/dist/services/backportRun/runSequentially.test.d.ts +0 -1
  161. package/dist/services/backportRun/runSequentially.test.js +0 -199
  162. package/dist/services/cherrypickAndCreateTargetPullRequest.d.ts +0 -12
  163. package/dist/services/cherrypickAndCreateTargetPullRequest.js +0 -206
  164. package/dist/services/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
  165. package/dist/services/cherrypickAndCreateTargetPullRequest.test.js +0 -403
  166. package/dist/services/env.test.d.ts +0 -1
  167. package/dist/services/env.test.js +0 -21
  168. package/dist/services/fs-promisified.d.ts +0 -6
  169. package/dist/services/fs-promisified.js +0 -12
  170. package/dist/services/getCommits.d.ts +0 -2
  171. package/dist/services/getCommits.js +0 -38
  172. package/dist/services/getCommitsWithoutBackports.d.ts +0 -11
  173. package/dist/services/getCommitsWithoutBackports.js +0 -68
  174. package/dist/services/getCommitsWithoutBackports.test.d.ts +0 -1
  175. package/dist/services/getCommitsWithoutBackports.test.js +0 -259
  176. package/dist/services/getExpectedTarget.d.ts +0 -9
  177. package/dist/services/getExpectedTarget.js +0 -77
  178. package/dist/services/getExpectedTargetPullRequests.d.ts +0 -9
  179. package/dist/services/getExpectedTargetPullRequests.js +0 -77
  180. package/dist/services/getTargetBranches.d.ts +0 -5
  181. package/dist/services/getTargetBranches.js +0 -60
  182. package/dist/services/getTargetBranches.test.d.ts +0 -1
  183. package/dist/services/getTargetBranches.test.js +0 -180
  184. package/dist/services/git.integration.test.d.ts +0 -1
  185. package/dist/services/git.integration.test.js +0 -168
  186. package/dist/services/git.test.d.ts +0 -1
  187. package/dist/services/git.test.js +0 -503
  188. package/dist/services/github/commitFormatters.test.d.ts +0 -1
  189. package/dist/services/github/commitFormatters.test.js +0 -11
  190. package/dist/services/github/v3/addAssigneesToPullRequest.test.d.ts +0 -1
  191. package/dist/services/github/v3/addAssigneesToPullRequest.test.js +0 -27
  192. package/dist/services/github/v3/createPullRequest.test.d.ts +0 -1
  193. package/dist/services/github/v3/createPullRequest.test.js +0 -160
  194. package/dist/services/github/v3/createStatusComment.test.d.ts +0 -1
  195. package/dist/services/github/v3/createStatusComment.test.js +0 -326
  196. package/dist/services/github/v4/apiRequestV4.test.d.ts +0 -1
  197. package/dist/services/github/v4/apiRequestV4.test.js +0 -82
  198. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.d.ts +0 -1
  199. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +0 -112
  200. package/dist/services/github/v4/fetchAuthorId.private.test.d.ts +0 -1
  201. package/dist/services/github/v4/fetchAuthorId.private.test.js +0 -28
  202. package/dist/services/github/v4/fetchCommitByPullNumber.d.ts +0 -5
  203. package/dist/services/github/v4/fetchCommitByPullNumber.js +0 -86
  204. package/dist/services/github/v4/fetchCommitByPullNumber.private.test.d.ts +0 -1
  205. package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +0 -57
  206. package/dist/services/github/v4/fetchCommitBySha.d.ts +0 -5
  207. package/dist/services/github/v4/fetchCommitBySha.js +0 -95
  208. package/dist/services/github/v4/fetchCommitBySha.private.test.d.ts +0 -1
  209. package/dist/services/github/v4/fetchCommitBySha.private.test.js +0 -50
  210. package/dist/services/github/v4/fetchCommits/allFetchers.private.test.d.ts +0 -1
  211. package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +0 -78
  212. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +0 -1
  213. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +0 -134
  214. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +0 -1
  215. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +0 -115
  216. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +0 -1
  217. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +0 -200
  218. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +0 -1
  219. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +0 -131
  220. package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +0 -28
  221. package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +0 -52
  222. package/dist/services/github/v4/fetchCommits/fetchProjectConfig.d.ts +0 -3
  223. package/dist/services/github/v4/fetchCommits/fetchProjectConfig.js +0 -55
  224. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
  225. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +0 -85
  226. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +0 -1
  227. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +0 -252
  228. package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +0 -28
  229. package/dist/services/github/v4/fetchCommitsByAuthor.js +0 -161
  230. package/dist/services/github/v4/fetchCommitsByAuthor.private.test.d.ts +0 -1
  231. package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +0 -115
  232. package/dist/services/github/v4/fetchCommitsByAuthor.test.d.ts +0 -1
  233. package/dist/services/github/v4/fetchCommitsByAuthor.test.js +0 -272
  234. package/dist/services/github/v4/fetchDefaultBranch.d.ts +0 -9
  235. package/dist/services/github/v4/fetchDefaultBranch.js +0 -24
  236. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -4
  237. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -52
  238. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
  239. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
  240. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.d.ts +0 -4
  241. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.js +0 -72
  242. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.d.ts +0 -1
  243. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.js +0 -34
  244. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.d.ts +0 -40
  245. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.js +0 -72
  246. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -17
  247. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -69
  248. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
  249. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
  250. package/dist/services/github/v4/fetchExistingPullRequest.private.test.d.ts +0 -1
  251. package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +0 -47
  252. package/dist/services/github/v4/fetchMergedPullRequests.d.ts +0 -37
  253. package/dist/services/github/v4/fetchMergedPullRequests.js +0 -37
  254. package/dist/services/github/v4/fetchMergedPullRequests.private.test.d.ts +0 -1
  255. package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +0 -59
  256. package/dist/services/github/v4/fetchMergedPullRequests.test.d.ts +0 -1
  257. package/dist/services/github/v4/fetchMergedPullRequests.test.js +0 -22
  258. package/dist/services/github/v4/fetchProjectConfig.d.ts +0 -8
  259. package/dist/services/github/v4/fetchProjectConfig.js +0 -56
  260. package/dist/services/github/v4/fetchProjectConfig.private.test.d.ts +0 -1
  261. package/dist/services/github/v4/fetchProjectConfig.private.test.js +0 -52
  262. package/dist/services/github/v4/fetchProjectConfig.test.d.ts +0 -1
  263. package/dist/services/github/v4/fetchProjectConfig.test.js +0 -37
  264. package/dist/services/github/v4/fetchPullRequestBySearchQuery.d.ts +0 -9
  265. package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +0 -92
  266. package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
  267. package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +0 -66
  268. package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.d.ts +0 -1
  269. package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +0 -242
  270. package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.d.ts +0 -1
  271. package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +0 -52
  272. package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +0 -7
  273. package/dist/services/github/v4/getExistingTargetPullRequests.js +0 -45
  274. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +0 -1
  275. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +0 -130
  276. package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +0 -63
  277. package/dist/services/github/v4/getOptionsFromGithub/index.js +0 -139
  278. package/dist/services/github/v4/getOptionsFromGithub/index.private.test.d.ts +0 -1
  279. package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +0 -147
  280. package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -5
  281. package/dist/services/github/v4/getTargetBranchesFromLabels.js +0 -20
  282. package/dist/services/github/v4/getTargetBranchesFromLabels.test.d.ts +0 -1
  283. package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +0 -201
  284. package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +0 -2
  285. package/dist/services/github/v4/mocks/commitsByAuthorMock.js +0 -154
  286. package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +0 -2
  287. package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +0 -843
  288. package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +0 -2
  289. package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +0 -73
  290. package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +0 -12
  291. package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +0 -44
  292. package/dist/services/github/v4/throwOnInvalidAccessToken.test.d.ts +0 -1
  293. package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +0 -87
  294. package/dist/services/maybeSetupRepo.d.ts +0 -2
  295. package/dist/services/maybeSetupRepo.js +0 -33
  296. package/dist/services/maybeSetupRepo.test.d.ts +0 -1
  297. package/dist/services/maybeSetupRepo.test.js +0 -78
  298. package/dist/services/prompt.test.d.ts +0 -1
  299. package/dist/services/prompt.test.js +0 -87
  300. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +0 -1
  301. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +0 -433
  302. package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +0 -5
  303. package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +0 -20
  304. package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +0 -1
  305. package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +0 -201
  306. package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +0 -1
  307. package/dist/services/sourceCommit/parseSourceCommit.test.js +0 -237
  308. package/dist/services/sourceCommit/sourceCommit.d.ts +0 -78
  309. package/dist/services/sourceCommit/sourceCommit.js +0 -86
  310. package/dist/services/sourceCommit/sourceCommit.test.d.ts +0 -1
  311. package/dist/services/sourceCommit/sourceCommit.test.js +0 -287
  312. package/dist/services/sourceCommit.d.ts +0 -78
  313. package/dist/services/sourceCommit.js +0 -86
  314. package/dist/services/sourceCommit.test.d.ts +0 -1
  315. package/dist/services/sourceCommit.test.js +0 -280
  316. package/dist/test/ExecError.d.ts +0 -16
  317. package/dist/test/ExecError.js +0 -15
  318. package/dist/test/backport-e2e.private.test.d.ts +0 -1
  319. package/dist/test/backport-e2e.private.test.js +0 -325
  320. package/dist/test/handleUnbackportedPullRequests.private.test.d.ts +0 -1
  321. package/dist/test/handleUnbackportedPullRequests.private.test.js +0 -43
  322. package/dist/test/inquirer.private.test.d.ts +0 -1
  323. package/dist/test/inquirer.private.test.js +0 -170
  324. package/dist/test/integration/createSpies.d.ts +0 -17
  325. package/dist/test/integration/createSpies.js +0 -85
  326. package/dist/test/integration/envConstants.d.ts +0 -5
  327. package/dist/test/integration/envConstants.js +0 -9
  328. package/dist/test/integration/helpers.d.ts +0 -7
  329. package/dist/test/integration/helpers.js +0 -31
  330. package/dist/test/integration/integration.private.test.d.ts +0 -1
  331. package/dist/test/integration/integration.private.test.js +0 -327
  332. package/dist/test/integration/integration.test.d.ts +0 -1
  333. package/dist/test/integration/integration.test.js +0 -214
  334. package/dist/test/mockConfigFiles.d.ts +0 -5
  335. package/dist/test/mockConfigFiles.js +0 -37
  336. package/dist/test/nockHelpers.d.ts +0 -16
  337. package/dist/test/nockHelpers.js +0 -32
  338. package/dist/test/private/getDevAccessToken.d.ts +0 -1
  339. package/dist/test/private/getDevAccessToken.js +0 -24
  340. package/dist/test/setupFiles/automatic-mocks.d.ts +0 -0
  341. package/dist/test/setupFiles/automatic-mocks.js +0 -43
  342. package/dist/todo-delete.d.ts +0 -1
  343. package/dist/todo-delete.js +0 -17
  344. package/dist/types/Commit.d.ts +0 -85
  345. package/dist/types/Commit.js +0 -139
  346. package/dist/types/PromiseReturnType.d.ts +0 -1
  347. package/dist/types/commitNode.d.ts +0 -89
  348. package/dist/types/commitNode.js +0 -139
  349. package/dist/types/commitNode.test.d.ts +0 -1
  350. package/dist/types/commitNode.test.js +0 -255
  351. package/dist/types/commitWithAssociatedPullRequests.d.ts +0 -86
  352. package/dist/types/commitWithAssociatedPullRequests.js +0 -145
  353. package/dist/ui/cherrypickAndCreatePullRequest.test.d.ts +0 -1
  354. package/dist/ui/cherrypickAndCreatePullRequest.test.js +0 -617
  355. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
  356. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +0 -427
  357. package/dist/ui/getCommitsWithoutBackports.test.d.ts +0 -1
  358. package/dist/ui/getCommitsWithoutBackports.test.js +0 -259
  359. package/dist/ui/getTargetBranches.test.d.ts +0 -1
  360. package/dist/ui/getTargetBranches.test.js +0 -180
  361. package/dist/ui/getTargetBranchesFromLabels.d.ts +0 -6
  362. package/dist/ui/getTargetBranchesFromLabels.js +0 -40
  363. package/dist/ui/getTargetBranchesFromLabels.test.d.ts +0 -1
  364. package/dist/ui/getTargetBranchesFromLabels.test.js +0 -288
  365. package/dist/ui/maybeSetupRepo.test.d.ts +0 -1
  366. package/dist/ui/maybeSetupRepo.test.js +0 -78
  367. package/dist/utils/excludeUndefined.test.d.ts +0 -1
  368. package/dist/utils/excludeUndefined.test.js +0 -24
  369. package/dist/utils/sequentially.d.ts +0 -1
  370. package/dist/utils/sequentially.js +0 -10
@@ -1,139 +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.getOptionsFromGithub = void 0;
7
- const ora_1 = __importDefault(require("ora"));
8
- const parseRequiredOptions_1 = require("../../../../options/parseRequiredOptions");
9
- const filterEmpty_1 = require("../../../../utils/filterEmpty");
10
- const HandledError_1 = require("../../../HandledError");
11
- const git_1 = require("../../../git");
12
- const logger_1 = require("../../../logger");
13
- const apiRequestV4_1 = require("../apiRequestV4");
14
- const throwOnInvalidAccessToken_1 = require("../throwOnInvalidAccessToken");
15
- const query_1 = require("./query");
16
- async function getOptionsFromGithub(optionsFromConfigFiles, optionsFromCliArgs) {
17
- const options = {
18
- ...optionsFromConfigFiles,
19
- ...optionsFromCliArgs,
20
- };
21
- const { githubApiBaseUrlV4 } = options;
22
- const { accessToken, repoName, repoOwner } = (0, parseRequiredOptions_1.getRequiredOptions)(options);
23
- let res;
24
- const spinner = (0, ora_1.default)().start('Initializing...');
25
- try {
26
- res = await (0, apiRequestV4_1.apiRequestV4)({
27
- githubApiBaseUrlV4,
28
- accessToken,
29
- query: query_1.query,
30
- variables: { repoOwner, repoName },
31
- handleError: false,
32
- });
33
- spinner.stop();
34
- }
35
- catch (e) {
36
- spinner.stop();
37
- const error = e;
38
- (0, throwOnInvalidAccessToken_1.throwOnInvalidAccessToken)({
39
- error,
40
- repoName,
41
- repoOwner,
42
- });
43
- const configFileNotFound = error.response?.data.errors?.some((error) => error.type === 'NOT_FOUND' &&
44
- error.path.join('.') ===
45
- 'repository.defaultBranchRef.target.history.edges.0.remoteConfig.file');
46
- if (configFileNotFound && error.response?.data.data) {
47
- // swallow error if caused by missing config file on Github
48
- res = error.response.data.data;
49
- }
50
- else {
51
- // throw generic Github error
52
- throw (0, apiRequestV4_1.handleGithubV4Error)(error);
53
- }
54
- }
55
- // get the original repo (not the fork)
56
- const repo = res.repository.isFork ? res.repository.parent : res.repository;
57
- // it is not possible to have a branch named "backport"
58
- if (repo.ref?.name === 'backport') {
59
- throw new HandledError_1.HandledError('You must delete the branch "backport" to continue. See https://github.com/sqren/backport/issues/155 for details');
60
- }
61
- const historicalRemoteConfigs = repo.defaultBranchRef.target.history.edges;
62
- const latestRemoteConfig = historicalRemoteConfigs[0]?.remoteConfig;
63
- const skipRemoteConfig = await getSkipRemoteConfigFile(options, latestRemoteConfig);
64
- const defaultBranch = repo.defaultBranchRef.name;
65
- // if no sourceBranch is given, use the `defaultBranch` (normally "master")
66
- const sourceBranch = options.sourceBranch
67
- ? options.sourceBranch
68
- : defaultBranch;
69
- return {
70
- sourceBranch,
71
- ...(skipRemoteConfig ? {} : parseRemoteConfig(latestRemoteConfig)),
72
- historicalBranchLabelMappings: skipRemoteConfig
73
- ? []
74
- : getHistoricalBranchLabelMappings(historicalRemoteConfigs),
75
- };
76
- }
77
- exports.getOptionsFromGithub = getOptionsFromGithub;
78
- async function getSkipRemoteConfigFile(options, remoteConfig) {
79
- if (options.forceLocalConfig) {
80
- logger_1.logger.info('Skipping remote config: `--force-local-config` specified via config file or cli');
81
- return true;
82
- }
83
- if (!remoteConfig) {
84
- logger_1.logger.info("Skipping remote config: remote config doesn't exist");
85
- return true;
86
- }
87
- const [isLocalConfigModified, isLocalConfigUntracked, localCommitDate] = await Promise.all([
88
- (0, git_1.isLocalConfigFileModified)(),
89
- (0, git_1.isLocalConfigFileUntracked)(),
90
- (0, git_1.getLocalConfigFileCommitDate)(),
91
- ]);
92
- if (isLocalConfigUntracked) {
93
- logger_1.logger.info('Skipping remote config: local config is new');
94
- return true;
95
- }
96
- if (isLocalConfigModified) {
97
- logger_1.logger.info('Skipping remote config: local config is modified');
98
- return true;
99
- }
100
- if (localCommitDate &&
101
- localCommitDate > Date.parse(remoteConfig.committedDate)) {
102
- logger_1.logger.info(`Skipping remote config: local config is newer: ${new Date(localCommitDate).toISOString()} > ${remoteConfig.committedDate}`);
103
- return true;
104
- }
105
- return false;
106
- }
107
- function parseRemoteConfig(remoteConfig) {
108
- if (!remoteConfig) {
109
- return;
110
- }
111
- try {
112
- logger_1.logger.info('Using remote config');
113
- return JSON.parse(remoteConfig.file.object.text);
114
- }
115
- catch (e) {
116
- logger_1.logger.info('Parsing remote config failed', e);
117
- return;
118
- }
119
- }
120
- function getHistoricalBranchLabelMappings(historicalRemoteConfigs) {
121
- return historicalRemoteConfigs
122
- .map((edge) => {
123
- try {
124
- const remoteConfig = JSON.parse(edge.remoteConfig.file.object.text);
125
- if (!remoteConfig.branchLabelMapping) {
126
- return;
127
- }
128
- return {
129
- branchLabelMapping: remoteConfig.branchLabelMapping,
130
- committedDate: edge.remoteConfig.committedDate,
131
- };
132
- }
133
- catch (e) {
134
- logger_1.logger.info('Could not get historical remote config', e);
135
- return;
136
- }
137
- })
138
- .filter(filterEmpty_1.filterNil);
139
- }
@@ -1,147 +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 os_1 = __importDefault(require("os"));
7
- const getDevAccessToken_1 = require("../../../../test/private/getDevAccessToken");
8
- const _1 = require(".");
9
- describe('getOptionsFromGithub', () => {
10
- let devAccessToken;
11
- beforeAll(async () => {
12
- devAccessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
13
- jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
14
- });
15
- describe('access token', () => {
16
- describe('is invalid', () => {
17
- it('throws an error', async () => {
18
- const optionsFromConfigFiles = {
19
- username: 'sqren',
20
- accessToken: 'foo',
21
- githubApiBaseUrlV4: 'https://api.github.com/graphql',
22
- upstream: 'backport-org/backport-e2e',
23
- };
24
- const optionsFromCliArgs = {};
25
- await expect((0, _1.getOptionsFromGithub)(optionsFromConfigFiles, optionsFromCliArgs)).rejects.toThrowError('Please check your access token and make sure it is valid.\nConfig: /myHomeDir/.backport/config.json');
26
- });
27
- });
28
- describe('is valid', () => {
29
- it('returns the options', async () => {
30
- const optionsFromConfigFiles = {
31
- username: 'sqren',
32
- accessToken: devAccessToken,
33
- githubApiBaseUrlV4: 'https://api.github.com/graphql',
34
- upstream: 'backport-org/backport-e2e',
35
- };
36
- const optionsFromCliArgs = {};
37
- expect(await (0, _1.getOptionsFromGithub)(optionsFromConfigFiles, optionsFromCliArgs)).toEqual({
38
- branchLabelMapping: {
39
- '^v(\\d+).(\\d+).\\d+$': '$1.$2',
40
- '^v7.9.0$': '7.x',
41
- '^v8.0.0$': 'master',
42
- },
43
- historicalBranchLabelMappings: [
44
- {
45
- branchLabelMapping: {
46
- '^v(\\d+).(\\d+).\\d+$': '$1.$2',
47
- '^v7.9.0$': '7.x',
48
- '^v8.0.0$': 'master',
49
- },
50
- committedDate: '2020-08-15T10:33:06Z',
51
- },
52
- {
53
- branchLabelMapping: { '6.1': '6.1', '6.3': '6.3' },
54
- committedDate: '2020-08-15T10:20:23Z',
55
- },
56
- {
57
- branchLabelMapping: { '6.1': '6.1', '6.3': '6.3' },
58
- committedDate: '2020-08-15T10:17:57Z',
59
- },
60
- ],
61
- sourceBranch: 'master',
62
- targetBranchChoices: [
63
- { checked: true, name: 'master' },
64
- { checked: true, name: '7.x' },
65
- '7.8',
66
- ],
67
- targetPRLabels: ['backport'],
68
- upstream: 'backport-org/backport-e2e',
69
- });
70
- });
71
- });
72
- });
73
- describe('when using fork as upstream', () => {
74
- it('uses upstream of parent', async () => {
75
- const optionsFromConfigFiles = {
76
- username: 'sqren',
77
- accessToken: devAccessToken,
78
- githubApiBaseUrlV4: 'https://api.github.com/graphql',
79
- upstream: 'sqren/backport-e2e',
80
- };
81
- const optionsFromCliArgs = {};
82
- const options = await (0, _1.getOptionsFromGithub)(optionsFromConfigFiles, optionsFromCliArgs);
83
- await expect(options.upstream).toEqual('backport-org/backport-e2e');
84
- });
85
- });
86
- describe('sourceBranch', () => {
87
- describe('when no sourceBranch is specified', () => {
88
- it('uses the default branch of the repo', async () => {
89
- const optionsFromConfigFiles = {
90
- username: 'sqren',
91
- accessToken: devAccessToken,
92
- githubApiBaseUrlV4: 'https://api.github.com/graphql',
93
- upstream: 'backport-org/repo-with-non-standard-main-branch',
94
- };
95
- const optionsFromCliArgs = {};
96
- const options = await (0, _1.getOptionsFromGithub)(optionsFromConfigFiles, optionsFromCliArgs);
97
- await expect(options.sourceBranch).toEqual('my-custom-default-branch');
98
- });
99
- });
100
- describe('when sourceBranch is specified', () => {
101
- it('uses that as sourceBranch if nothing else is specified', async () => {
102
- const optionsFromConfigFiles = {
103
- sourceBranch: 'my-specific-source-branch',
104
- username: 'sqren',
105
- accessToken: devAccessToken,
106
- githubApiBaseUrlV4: 'https://api.github.com/graphql',
107
- upstream: 'backport-org/repo-with-non-standard-main-branch',
108
- };
109
- const optionsFromCliArgs = {};
110
- const options = await (0, _1.getOptionsFromGithub)(optionsFromConfigFiles, optionsFromCliArgs);
111
- await expect(options.sourceBranch).toEqual('my-specific-source-branch');
112
- });
113
- });
114
- });
115
- describe('when a branch named "backport"', () => {
116
- describe('exists', () => {
117
- it('shows a warning', async () => {
118
- const optionsFromConfigFiles = {
119
- username: 'sqren',
120
- accessToken: devAccessToken,
121
- githubApiBaseUrlV4: 'https://api.github.com/graphql',
122
- upstream: 'backport-org/repo-with-branch-named-backport',
123
- };
124
- const optionsFromCliArgs = {};
125
- await expect(async () => {
126
- await (0, _1.getOptionsFromGithub)(optionsFromConfigFiles, optionsFromCliArgs);
127
- }).rejects.toThrowError('You must delete the branch "backport" to continue. See https://github.com/sqren/backport/issues/155 for details');
128
- });
129
- });
130
- });
131
- describe('when a backportrc.json config was deleted from repo', () => {
132
- it('does not throw', async () => {
133
- const optionsFromConfigFiles = {
134
- username: 'sqren',
135
- accessToken: devAccessToken,
136
- githubApiBaseUrlV4: 'https://api.github.com/graphql',
137
- upstream: 'backport-org/repo-with-backportrc-removed',
138
- };
139
- const optionsFromCliArgs = {};
140
- const options = await (0, _1.getOptionsFromGithub)(optionsFromConfigFiles, optionsFromCliArgs);
141
- expect(options).toEqual({
142
- sourceBranch: 'main',
143
- historicalBranchLabelMappings: [],
144
- });
145
- });
146
- });
147
- });
@@ -1,5 +0,0 @@
1
- import { ValidConfigOptions } from '../../../options/options';
2
- export declare function getTargetBranchForLabel({ branchLabelMapping, label, }: {
3
- branchLabelMapping: NonNullable<ValidConfigOptions['branchLabelMapping']>;
4
- label: string;
5
- }): string | undefined;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTargetBranchForLabel = void 0;
4
- function getTargetBranchForLabel({ branchLabelMapping, label, }) {
5
- // only get first match
6
- const result = Object.entries(branchLabelMapping).find(([labelPattern]) => {
7
- const regex = new RegExp(labelPattern);
8
- const isMatch = label.match(regex) !== null;
9
- return isMatch;
10
- });
11
- if (result) {
12
- const [labelPattern, targetBranchPattern] = result;
13
- const regex = new RegExp(labelPattern);
14
- const targetBranch = label.replace(regex, targetBranchPattern);
15
- if (targetBranch) {
16
- return targetBranch;
17
- }
18
- }
19
- }
20
- exports.getTargetBranchForLabel = getTargetBranchForLabel;
@@ -1,201 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const getTargetBranchesFromLabels_1 = require("./getTargetBranchesFromLabels");
4
- describe('getTargetBranchesFromLabels', () => {
5
- it(`should support Kibana's label format`, () => {
6
- const sourceBranch = 'master';
7
- const expectedTargetPullRequests = [];
8
- const branchLabelMapping = {
9
- 'v8.0.0': 'master',
10
- '^v7.8.0$': '7.x',
11
- '^v(\\d+).(\\d+).\\d+$': '$1.$2', // all other branches
12
- };
13
- const labels = [
14
- 'release_note:fix',
15
- 'v5.4.3',
16
- 'v5.5.3',
17
- 'v5.6.16',
18
- 'v6.0.1',
19
- 'v6.1.4',
20
- 'v6.2.5',
21
- 'v6.3.3',
22
- 'v6.4.4',
23
- 'v6.5.5',
24
- 'v6.6.3',
25
- 'v6.7.2',
26
- 'v6.8.4',
27
- 'v7.0.2',
28
- 'v7.1.2',
29
- 'v7.2.2',
30
- 'v7.3.3',
31
- 'v7.4.1',
32
- 'v7.5.0',
33
- 'v7.6.0',
34
- 'v7.7.0',
35
- 'v7.8.0',
36
- 'v8.0.0', // master
37
- ];
38
- const targetBranches = (0, getTargetBranchesFromLabels_1.getTargetBranchesFromLabels)({
39
- sourceBranch,
40
- expectedTargetPullRequests,
41
- branchLabelMapping,
42
- labels,
43
- });
44
- expect(targetBranches.expected).toEqual([
45
- '5.4',
46
- '5.5',
47
- '5.6',
48
- '6.0',
49
- '6.1',
50
- '6.2',
51
- '6.3',
52
- '6.4',
53
- '6.5',
54
- '6.6',
55
- '6.7',
56
- '6.8',
57
- '7.0',
58
- '7.1',
59
- '7.2',
60
- '7.3',
61
- '7.4',
62
- '7.5',
63
- '7.6',
64
- '7.7',
65
- '7.x',
66
- ]);
67
- });
68
- it('should only get first match', () => {
69
- const sourceBranch = 'master';
70
- const expectedTargetPullRequests = [];
71
- const branchLabelMapping = {
72
- 'label-2': 'branch-b',
73
- 'label-(\\d+)': 'branch-$1',
74
- };
75
- const labels = ['label-2'];
76
- const targetBranches = (0, getTargetBranchesFromLabels_1.getTargetBranchesFromLabels)({
77
- sourceBranch,
78
- expectedTargetPullRequests,
79
- labels,
80
- branchLabelMapping,
81
- });
82
- expect(targetBranches).toEqual({
83
- expected: ['branch-b'],
84
- missing: ['branch-b'],
85
- unmerged: [],
86
- merged: [],
87
- });
88
- });
89
- it('open PRs', () => {
90
- const sourceBranch = 'master';
91
- const expectedTargetPullRequests = [
92
- { branch: 'branch-3', state: 'OPEN' },
93
- ];
94
- const branchLabelMapping = {
95
- 'label-(\\d+)': 'branch-$1',
96
- };
97
- const labels = ['label-1', 'label-2', 'label-3', 'label-4'];
98
- const targetBranches = (0, getTargetBranchesFromLabels_1.getTargetBranchesFromLabels)({
99
- sourceBranch,
100
- expectedTargetPullRequests,
101
- labels,
102
- branchLabelMapping,
103
- });
104
- expect(targetBranches).toEqual({
105
- expected: ['branch-1', 'branch-2', 'branch-3', 'branch-4'],
106
- missing: ['branch-1', 'branch-2', 'branch-4'],
107
- unmerged: ['branch-3'],
108
- merged: [],
109
- });
110
- });
111
- it('closed PRs', () => {
112
- const sourceBranch = 'master';
113
- const expectedTargetPullRequests = [
114
- { branch: 'branch-3', state: 'CLOSED' },
115
- ];
116
- const branchLabelMapping = {
117
- 'label-(\\d+)': 'branch-$1',
118
- };
119
- const labels = ['label-1', 'label-2', 'label-3', 'label-4'];
120
- const targetBranches = (0, getTargetBranchesFromLabels_1.getTargetBranchesFromLabels)({
121
- sourceBranch,
122
- expectedTargetPullRequests,
123
- labels,
124
- branchLabelMapping,
125
- });
126
- expect(targetBranches).toEqual({
127
- expected: ['branch-1', 'branch-2', 'branch-3', 'branch-4'],
128
- missing: ['branch-1', 'branch-2', 'branch-4'],
129
- unmerged: ['branch-3'],
130
- merged: [],
131
- });
132
- });
133
- it('merged PRs', () => {
134
- const sourceBranch = 'master';
135
- const expectedTargetPullRequests = [
136
- { branch: 'branch-2', state: 'MERGED' },
137
- ];
138
- const branchLabelMapping = {
139
- 'label-(\\d+)': 'branch-$1',
140
- };
141
- const labels = ['label-1', 'label-2', 'label-3', 'label-4'];
142
- const targetBranches = (0, getTargetBranchesFromLabels_1.getTargetBranchesFromLabels)({
143
- sourceBranch,
144
- expectedTargetPullRequests,
145
- labels,
146
- branchLabelMapping,
147
- });
148
- expect(targetBranches).toEqual({
149
- expected: ['branch-1', 'branch-2', 'branch-3', 'branch-4'],
150
- missing: ['branch-1', 'branch-3', 'branch-4'],
151
- unmerged: [],
152
- merged: ['branch-2'],
153
- });
154
- });
155
- it('should remove duplicates', () => {
156
- const sourceBranch = 'master';
157
- const expectedTargetPullRequests = [];
158
- const branchLabelMapping = {
159
- 'label-(\\d+)': 'branch-$1',
160
- };
161
- const labels = ['label-1', 'label-2', 'label-2'];
162
- const targetBranches = (0, getTargetBranchesFromLabels_1.getTargetBranchesFromLabels)({
163
- sourceBranch,
164
- expectedTargetPullRequests,
165
- labels,
166
- branchLabelMapping,
167
- });
168
- expect(targetBranches.expected).toEqual(['branch-1', 'branch-2']);
169
- });
170
- it('should ignore non-matching labels', () => {
171
- const sourceBranch = 'master';
172
- const expectedTargetPullRequests = [];
173
- const branchLabelMapping = {
174
- 'label-(\\d+)': 'branch-$1',
175
- };
176
- const labels = ['label-1', 'label-2', 'foo', 'bar'];
177
- const targetBranches = (0, getTargetBranchesFromLabels_1.getTargetBranchesFromLabels)({
178
- sourceBranch,
179
- expectedTargetPullRequests,
180
- labels,
181
- branchLabelMapping,
182
- });
183
- expect(targetBranches.expected).toEqual(['branch-1', 'branch-2']);
184
- });
185
- it('should omit empty labels', () => {
186
- const sourceBranch = 'master';
187
- const expectedTargetPullRequests = [];
188
- const branchLabelMapping = {
189
- 'label-2': '',
190
- 'label-(\\d+)': 'branch-$1',
191
- };
192
- const labels = ['label-1', 'label-2'];
193
- const targetBranches = (0, getTargetBranchesFromLabels_1.getTargetBranchesFromLabels)({
194
- sourceBranch,
195
- expectedTargetPullRequests,
196
- labels,
197
- branchLabelMapping,
198
- });
199
- expect(targetBranches.expected).toEqual(['branch-1']);
200
- });
201
- });
@@ -1,2 +0,0 @@
1
- import { CommitByAuthorResponse } from '../fetchCommits/fetchCommitsByAuthor';
2
- export declare const commitsByAuthorMock: CommitByAuthorResponse;