backport 6.1.4 → 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 (291) hide show
  1. package/README.md +53 -42
  2. package/dist/{main.d.ts → backportRun.d.ts} +3 -3
  3. package/dist/{main.js → backportRun.js} +24 -9
  4. package/dist/entrypoint.cli.js +3 -5
  5. package/dist/entrypoint.module.d.ts +4 -3
  6. package/dist/entrypoint.module.js +9 -7
  7. package/dist/options/ConfigOptions.d.ts +6 -0
  8. package/dist/options/cliArgs.d.ts +17 -13
  9. package/dist/options/cliArgs.js +25 -6
  10. package/dist/options/config/config.d.ts +12 -1
  11. package/dist/options/config/config.js +8 -7
  12. package/dist/options/config/globalConfig.d.ts +2 -2
  13. package/dist/options/config/globalConfig.js +18 -16
  14. package/dist/options/config/projectConfig.d.ts +3 -1
  15. package/dist/options/config/projectConfig.js +5 -2
  16. package/dist/options/config/readConfigFile.d.ts +28 -22
  17. package/dist/options/config/readConfigFile.js +2 -2
  18. package/dist/options/options.d.ts +19 -37
  19. package/dist/options/options.js +44 -31
  20. package/dist/runSequentially.d.ts +0 -1
  21. package/dist/runSequentially.js +0 -1
  22. package/dist/scripts/postinstall.js +3 -3
  23. package/dist/services/HandledError.d.ts +6 -4
  24. package/dist/services/HandledError.js +18 -3
  25. package/dist/services/child-process-promisified.d.ts +3 -1
  26. package/dist/services/env.d.ts +5 -4
  27. package/dist/services/env.js +13 -11
  28. package/dist/services/git.d.ts +22 -9
  29. package/dist/services/git.js +66 -54
  30. package/dist/services/github/commitFormatters.d.ts +0 -1
  31. package/dist/services/github/commitFormatters.js +1 -8
  32. package/dist/services/github/v3/createPullRequest.js +16 -10
  33. package/dist/services/github/v3/createStatusComment.d.ts +1 -1
  34. package/dist/services/github/v3/createStatusComment.js +34 -18
  35. package/dist/services/github/v3/getGithubV3ErrorMessage.d.ts +2 -1
  36. package/dist/services/github/v4/FetchPullRequestId.d.ts +0 -7
  37. package/dist/services/github/v4/apiRequestV4.d.ts +21 -17
  38. package/dist/services/github/v4/apiRequestV4.js +38 -28
  39. package/dist/services/github/v4/disablePullRequestAutoMerge.d.ts +0 -7
  40. package/dist/services/github/v4/enablePullRequestAutoMerge.d.ts +0 -7
  41. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -3
  42. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +2 -2
  43. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +1 -8
  44. package/dist/services/github/v4/fetchExistingPullRequest.d.ts +0 -4
  45. package/dist/services/github/v4/fetchExistingPullRequest.js +1 -2
  46. package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +0 -9
  47. package/dist/services/github/v4/{fetchProjectConfig.d.ts → fetchRemoteProjectConfig.d.ts} +1 -1
  48. package/dist/services/github/v4/{fetchProjectConfig.js → fetchRemoteProjectConfig.js} +3 -3
  49. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +7 -1
  50. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +38 -39
  51. package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +2 -1
  52. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +29 -0
  53. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.js +56 -0
  54. package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +4 -5
  55. package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -7
  56. package/dist/services/logger.d.ts +9 -4
  57. package/dist/services/logger.js +40 -37
  58. package/dist/services/prompts.js +12 -10
  59. package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +1 -1
  60. package/dist/services/sourceCommit/getMockSourceCommit.js +6 -6
  61. package/dist/services/sourceCommit/parseSourceCommit.d.ts +18 -10
  62. package/dist/services/sourceCommit/parseSourceCommit.js +20 -14
  63. package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +0 -1
  64. package/dist/ui/cherrypickAndCreateTargetPullRequest.js +13 -14
  65. package/dist/ui/getCommits.js +8 -14
  66. package/dist/ui/getCommitsWithoutBackports.js +6 -6
  67. package/dist/ui/getTargetBranches.js +1 -1
  68. package/dist/ui/maybeSetupRepo.js +24 -10
  69. package/dist/utils/maybe.d.ts +1 -0
  70. package/dist/utils/maybe.js +7 -0
  71. package/dist/utils/packageVersion.d.ts +1 -0
  72. package/dist/{types/PromiseReturnType.js → utils/packageVersion.js} +2 -0
  73. package/dist/utils/redact.d.ts +1 -0
  74. package/dist/utils/redact.js +7 -0
  75. package/package.json +24 -20
  76. package/yarn.lock +160 -237
  77. package/dist/entrypoint.module.private.test.d.ts +0 -1
  78. package/dist/entrypoint.module.private.test.js +0 -37
  79. package/dist/index.d.ts +0 -783
  80. package/dist/index.js +0 -8001
  81. package/dist/ink.d.ts +0 -1
  82. package/dist/ink.js +0 -49
  83. package/dist/options/cliArgs.test.d.ts +0 -1
  84. package/dist/options/cliArgs.test.js +0 -152
  85. package/dist/options/config/config.test.d.ts +0 -1
  86. package/dist/options/config/config.test.js +0 -22
  87. package/dist/options/config/getOptionsFromGit.d.ts +0 -4
  88. package/dist/options/config/getOptionsFromGit.js +0 -8
  89. package/dist/options/config/globalConfig.test.d.ts +0 -1
  90. package/dist/options/config/globalConfig.test.js +0 -74
  91. package/dist/options/config/projectConfig.test.d.ts +0 -1
  92. package/dist/options/config/projectConfig.test.js +0 -99
  93. package/dist/options/getValidatedOptions.d.ts +0 -49
  94. package/dist/options/getValidatedOptions.js +0 -45
  95. package/dist/options/getValidatedOptions.test.d.ts +0 -1
  96. package/dist/options/getValidatedOptions.test.js +0 -97
  97. package/dist/options/options.test.d.ts +0 -1
  98. package/dist/options/options.test.js +0 -335
  99. package/dist/options/parseRequiredOptions.d.ts +0 -71
  100. package/dist/options/parseRequiredOptions.js +0 -68
  101. package/dist/options/parseRequiredOptions.test.d.ts +0 -1
  102. package/dist/options/parseRequiredOptions.test.js +0 -122
  103. package/dist/runSequentially.test.d.ts +0 -1
  104. package/dist/runSequentially.test.js +0 -199
  105. package/dist/runWithOptions.d.ts +0 -9
  106. package/dist/runWithOptions.js +0 -43
  107. package/dist/runWithOptions.test.d.ts +0 -1
  108. package/dist/runWithOptions.test.js +0 -304
  109. package/dist/scripts/generate-gql.d.ts +0 -1
  110. package/dist/scripts/generate-gql.js +0 -15
  111. package/dist/scripts/postinstall.test.d.ts +0 -1
  112. package/dist/scripts/postinstall.test.js +0 -53
  113. package/dist/services/env.test.d.ts +0 -1
  114. package/dist/services/env.test.js +0 -27
  115. package/dist/services/fs-promisified.d.ts +0 -6
  116. package/dist/services/fs-promisified.js +0 -12
  117. package/dist/services/getExpectedTarget.d.ts +0 -9
  118. package/dist/services/getExpectedTarget.js +0 -77
  119. package/dist/services/getExpectedTargetPullRequests.d.ts +0 -9
  120. package/dist/services/getExpectedTargetPullRequests.js +0 -77
  121. package/dist/services/git.integration.test.d.ts +0 -1
  122. package/dist/services/git.integration.test.js +0 -168
  123. package/dist/services/git.test.d.ts +0 -1
  124. package/dist/services/git.test.js +0 -503
  125. package/dist/services/github/commitFormatters.test.d.ts +0 -1
  126. package/dist/services/github/commitFormatters.test.js +0 -11
  127. package/dist/services/github/v3/addAssigneesToPullRequest.test.d.ts +0 -1
  128. package/dist/services/github/v3/addAssigneesToPullRequest.test.js +0 -27
  129. package/dist/services/github/v3/createPullRequest.test.d.ts +0 -1
  130. package/dist/services/github/v3/createPullRequest.test.js +0 -110
  131. package/dist/services/github/v3/createStatusComment.test.d.ts +0 -1
  132. package/dist/services/github/v3/createStatusComment.test.js +0 -291
  133. package/dist/services/github/v4/apiRequestV4.test.d.ts +0 -1
  134. package/dist/services/github/v4/apiRequestV4.test.js +0 -82
  135. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.d.ts +0 -1
  136. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +0 -112
  137. package/dist/services/github/v4/fetchAuthorId.private.test.d.ts +0 -1
  138. package/dist/services/github/v4/fetchAuthorId.private.test.js +0 -28
  139. package/dist/services/github/v4/fetchCommitByPullNumber.d.ts +0 -5
  140. package/dist/services/github/v4/fetchCommitByPullNumber.js +0 -86
  141. package/dist/services/github/v4/fetchCommitByPullNumber.private.test.d.ts +0 -1
  142. package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +0 -57
  143. package/dist/services/github/v4/fetchCommitBySha.d.ts +0 -5
  144. package/dist/services/github/v4/fetchCommitBySha.js +0 -95
  145. package/dist/services/github/v4/fetchCommitBySha.private.test.d.ts +0 -1
  146. package/dist/services/github/v4/fetchCommitBySha.private.test.js +0 -50
  147. package/dist/services/github/v4/fetchCommits/allFetchers.private.test.d.ts +0 -1
  148. package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +0 -78
  149. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +0 -1
  150. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +0 -134
  151. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +0 -1
  152. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +0 -115
  153. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +0 -1
  154. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +0 -200
  155. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +0 -1
  156. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +0 -131
  157. package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +0 -28
  158. package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +0 -52
  159. package/dist/services/github/v4/fetchCommits/fetchProjectConfig.d.ts +0 -3
  160. package/dist/services/github/v4/fetchCommits/fetchProjectConfig.js +0 -55
  161. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
  162. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +0 -85
  163. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +0 -1
  164. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +0 -252
  165. package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +0 -28
  166. package/dist/services/github/v4/fetchCommitsByAuthor.js +0 -161
  167. package/dist/services/github/v4/fetchCommitsByAuthor.private.test.d.ts +0 -1
  168. package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +0 -115
  169. package/dist/services/github/v4/fetchCommitsByAuthor.test.d.ts +0 -1
  170. package/dist/services/github/v4/fetchCommitsByAuthor.test.js +0 -272
  171. package/dist/services/github/v4/fetchDefaultBranch.d.ts +0 -9
  172. package/dist/services/github/v4/fetchDefaultBranch.js +0 -24
  173. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -4
  174. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -52
  175. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
  176. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
  177. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.d.ts +0 -4
  178. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.js +0 -72
  179. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.d.ts +0 -1
  180. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.js +0 -34
  181. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.d.ts +0 -40
  182. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.js +0 -72
  183. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -17
  184. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -69
  185. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
  186. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
  187. package/dist/services/github/v4/fetchExistingPullRequest.private.test.d.ts +0 -1
  188. package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +0 -47
  189. package/dist/services/github/v4/fetchMergedPullRequests.d.ts +0 -37
  190. package/dist/services/github/v4/fetchMergedPullRequests.js +0 -37
  191. package/dist/services/github/v4/fetchMergedPullRequests.private.test.d.ts +0 -1
  192. package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +0 -59
  193. package/dist/services/github/v4/fetchMergedPullRequests.test.d.ts +0 -1
  194. package/dist/services/github/v4/fetchMergedPullRequests.test.js +0 -22
  195. package/dist/services/github/v4/fetchProjectConfig.private.test.d.ts +0 -1
  196. package/dist/services/github/v4/fetchProjectConfig.private.test.js +0 -52
  197. package/dist/services/github/v4/fetchProjectConfig.test.d.ts +0 -1
  198. package/dist/services/github/v4/fetchProjectConfig.test.js +0 -37
  199. package/dist/services/github/v4/fetchPullRequestBySearchQuery.d.ts +0 -9
  200. package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +0 -92
  201. package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
  202. package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +0 -66
  203. package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.d.ts +0 -1
  204. package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +0 -242
  205. package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +0 -7
  206. package/dist/services/github/v4/getExistingTargetPullRequests.js +0 -45
  207. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +0 -1
  208. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +0 -130
  209. package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +0 -63
  210. package/dist/services/github/v4/getOptionsFromGithub/index.js +0 -139
  211. package/dist/services/github/v4/getOptionsFromGithub/index.private.test.d.ts +0 -1
  212. package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +0 -147
  213. package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -5
  214. package/dist/services/github/v4/getTargetBranchesFromLabels.js +0 -20
  215. package/dist/services/github/v4/getTargetBranchesFromLabels.test.d.ts +0 -1
  216. package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +0 -201
  217. package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +0 -2
  218. package/dist/services/github/v4/mocks/commitsByAuthorMock.js +0 -154
  219. package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +0 -2
  220. package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +0 -843
  221. package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +0 -2
  222. package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +0 -73
  223. package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +0 -12
  224. package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +0 -44
  225. package/dist/services/github/v4/throwOnInvalidAccessToken.test.d.ts +0 -1
  226. package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +0 -87
  227. package/dist/services/prompt.test.d.ts +0 -1
  228. package/dist/services/prompt.test.js +0 -87
  229. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +0 -1
  230. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +0 -433
  231. package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +0 -5
  232. package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +0 -20
  233. package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +0 -1
  234. package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +0 -201
  235. package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +0 -1
  236. package/dist/services/sourceCommit/parseSourceCommit.test.js +0 -237
  237. package/dist/services/sourceCommit/sourceCommit.d.ts +0 -78
  238. package/dist/services/sourceCommit/sourceCommit.js +0 -86
  239. package/dist/services/sourceCommit/sourceCommit.test.d.ts +0 -1
  240. package/dist/services/sourceCommit/sourceCommit.test.js +0 -287
  241. package/dist/services/sourceCommit.d.ts +0 -78
  242. package/dist/services/sourceCommit.js +0 -86
  243. package/dist/services/sourceCommit.test.d.ts +0 -1
  244. package/dist/services/sourceCommit.test.js +0 -280
  245. package/dist/test/ExecError.d.ts +0 -16
  246. package/dist/test/ExecError.js +0 -15
  247. package/dist/test/inquirer.private.test.d.ts +0 -1
  248. package/dist/test/inquirer.private.test.js +0 -168
  249. package/dist/test/integration/createSpies.d.ts +0 -17
  250. package/dist/test/integration/createSpies.js +0 -85
  251. package/dist/test/integration/envConstants.d.ts +0 -5
  252. package/dist/test/integration/envConstants.js +0 -9
  253. package/dist/test/integration/helpers.d.ts +0 -7
  254. package/dist/test/integration/helpers.js +0 -31
  255. package/dist/test/integration/integration.private.test.d.ts +0 -1
  256. package/dist/test/integration/integration.private.test.js +0 -327
  257. package/dist/test/integration/integration.test.d.ts +0 -1
  258. package/dist/test/integration/integration.test.js +0 -214
  259. package/dist/test/mockConfigFiles.d.ts +0 -5
  260. package/dist/test/mockConfigFiles.js +0 -37
  261. package/dist/test/nockHelpers.d.ts +0 -16
  262. package/dist/test/nockHelpers.js +0 -32
  263. package/dist/test/private/getDevAccessToken.d.ts +0 -1
  264. package/dist/test/private/getDevAccessToken.js +0 -24
  265. package/dist/test/setupFiles/automatic-mocks.d.ts +0 -0
  266. package/dist/test/setupFiles/automatic-mocks.js +0 -43
  267. package/dist/types/Commit.d.ts +0 -85
  268. package/dist/types/Commit.js +0 -139
  269. package/dist/types/PromiseReturnType.d.ts +0 -1
  270. package/dist/types/commitNode.d.ts +0 -89
  271. package/dist/types/commitNode.js +0 -139
  272. package/dist/types/commitNode.test.d.ts +0 -1
  273. package/dist/types/commitNode.test.js +0 -255
  274. package/dist/types/commitWithAssociatedPullRequests.d.ts +0 -86
  275. package/dist/types/commitWithAssociatedPullRequests.js +0 -145
  276. package/dist/ui/cherrypickAndCreatePullRequest.test.d.ts +0 -1
  277. package/dist/ui/cherrypickAndCreatePullRequest.test.js +0 -617
  278. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
  279. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +0 -432
  280. package/dist/ui/getCommitsWithoutBackports.test.d.ts +0 -1
  281. package/dist/ui/getCommitsWithoutBackports.test.js +0 -259
  282. package/dist/ui/getTargetBranches.test.d.ts +0 -1
  283. package/dist/ui/getTargetBranches.test.js +0 -180
  284. package/dist/ui/getTargetBranchesFromLabels.d.ts +0 -6
  285. package/dist/ui/getTargetBranchesFromLabels.js +0 -40
  286. package/dist/ui/getTargetBranchesFromLabels.test.d.ts +0 -1
  287. package/dist/ui/getTargetBranchesFromLabels.test.js +0 -288
  288. package/dist/ui/maybeSetupRepo.test.d.ts +0 -1
  289. package/dist/ui/maybeSetupRepo.test.js +0 -74
  290. package/dist/utils/excludeUndefined.test.d.ts +0 -1
  291. package/dist/utils/excludeUndefined.test.js +0 -24
@@ -1,11 +1,2 @@
1
1
  import { ValidConfigOptions } from '../../../options/options';
2
- export interface PullRequestAutoMergeResponse {
3
- repository: {
4
- pullRequest?: {
5
- autoMergeRequest?: {
6
- mergeMethod: string;
7
- };
8
- };
9
- };
10
- }
11
2
  export declare function fetchPullRequestAutoMergeMethod(options: ValidConfigOptions, pullNumber: number): Promise<string | undefined>;
@@ -1,5 +1,5 @@
1
1
  import { ConfigFileOptions } from '../../../entrypoint.module';
2
- export declare function fetchProjectConfig(options: {
2
+ export declare function fetchRemoteProjectConfig(options: {
3
3
  accessToken: string;
4
4
  githubApiBaseUrlV4?: string;
5
5
  repoName: string;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchProjectConfig = void 0;
3
+ exports.fetchRemoteProjectConfig = void 0;
4
4
  const readConfigFile_1 = require("../../../options/config/readConfigFile");
5
5
  const apiRequestV4_1 = require("./apiRequestV4");
6
- async function fetchProjectConfig(options) {
6
+ async function fetchRemoteProjectConfig(options) {
7
7
  const { accessToken, githubApiBaseUrlV4, repoName, repoOwner, sourceBranch } = options;
8
8
  const query = /* GraphQL */ `
9
9
  query ProjectConfig(
@@ -53,4 +53,4 @@ async function fetchProjectConfig(options) {
53
53
  throw new Error('Project config does not exist');
54
54
  }
55
55
  }
56
- exports.fetchProjectConfig = fetchProjectConfig;
56
+ exports.fetchRemoteProjectConfig = fetchRemoteProjectConfig;
@@ -1,10 +1,10 @@
1
- export declare type OptionsFromGithub = Awaited<ReturnType<typeof getOptionsFromGithub>>;
2
1
  export declare function getOptionsFromGithub(options: {
3
2
  accessToken: string;
4
3
  githubApiBaseUrlV4?: string;
5
4
  repoName: string;
6
5
  repoOwner: string;
7
6
  skipRemoteConfig?: boolean;
7
+ cwd?: string;
8
8
  }): Promise<{
9
9
  historicalBranchLabelMappings: {
10
10
  branchLabelMapping: Record<string, string>;
@@ -32,12 +32,15 @@ export declare function getOptionsFromGithub(options: {
32
32
  cherrypickRef?: boolean | undefined;
33
33
  ci?: boolean | undefined;
34
34
  commitPaths?: string[] | undefined;
35
+ configFile?: string | undefined;
35
36
  details?: boolean | undefined;
37
+ dir?: string | undefined;
36
38
  editor?: string | undefined;
37
39
  fork?: boolean | undefined;
38
40
  gitHostname?: string | undefined;
39
41
  githubApiBaseUrlV3?: string | undefined;
40
42
  githubApiBaseUrlV4?: string | undefined;
43
+ logFilePath?: string | undefined;
41
44
  maxNumber?: number | undefined;
42
45
  multiple?: boolean | undefined;
43
46
  multipleBranches?: boolean | undefined;
@@ -46,6 +49,7 @@ export declare function getOptionsFromGithub(options: {
46
49
  prDescription?: string | undefined;
47
50
  prFilter?: string | undefined;
48
51
  prTitle?: string | undefined;
52
+ publishStatusComment?: boolean | undefined;
49
53
  pullNumber?: number | undefined;
50
54
  repoName?: string | undefined;
51
55
  repoOwner?: string | undefined;
@@ -59,6 +63,8 @@ export declare function getOptionsFromGithub(options: {
59
63
  targetBranches?: string[] | undefined;
60
64
  targetPRLabels?: string[] | undefined;
61
65
  verbose?: boolean | undefined;
66
+ help?: boolean | undefined;
67
+ version?: boolean | undefined;
62
68
  branchLabelMapping?: Record<string, string> | undefined;
63
69
  upstream?: string | undefined;
64
70
  branches?: import("../../../../options/ConfigOptions").TargetBranchChoiceOrString[] | undefined;
@@ -1,10 +1,6 @@
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.getOptionsFromGithub = void 0;
7
- const ora_1 = __importDefault(require("ora"));
8
4
  const readConfigFile_1 = require("../../../../options/config/readConfigFile");
9
5
  const filterEmpty_1 = require("../../../../utils/filterEmpty");
10
6
  const HandledError_1 = require("../../../HandledError");
@@ -13,29 +9,28 @@ const logger_1 = require("../../../logger");
13
9
  const apiRequestV4_1 = require("../apiRequestV4");
14
10
  const throwOnInvalidAccessToken_1 = require("../throwOnInvalidAccessToken");
15
11
  const query_1 = require("./query");
12
+ // fetches the default source branch for the repo (normally "master")
13
+ // startup checks:
14
+ // - verify the access token
15
+ // - ensure no branch named "backport" exists
16
16
  async function getOptionsFromGithub(options) {
17
17
  const { accessToken, githubApiBaseUrlV4, repoName, repoOwner } = options;
18
18
  let res;
19
- const spinner = (0, ora_1.default)().start('Initializing...');
20
19
  try {
21
20
  res = await (0, apiRequestV4_1.apiRequestV4)({
22
21
  githubApiBaseUrlV4,
23
22
  accessToken,
24
23
  query: query_1.query,
25
24
  variables: { repoOwner, repoName },
26
- handleError: false,
27
25
  });
28
- spinner.stop();
29
26
  }
30
27
  catch (e) {
31
- spinner.stop();
28
+ if (!(e instanceof apiRequestV4_1.GithubV4Exception)) {
29
+ throw e;
30
+ }
32
31
  const error = e;
33
- (0, throwOnInvalidAccessToken_1.throwOnInvalidAccessToken)({
34
- error,
35
- repoName,
36
- repoOwner,
37
- });
38
- res = handleMissingConfigFile(error);
32
+ (0, throwOnInvalidAccessToken_1.throwOnInvalidAccessToken)({ error, repoName, repoOwner });
33
+ res = swallowErrorIfConfigFileIsMissing(error);
39
34
  }
40
35
  // get the original repo (not the fork)
41
36
  const repo = res.repository.isFork ? res.repository.parent : res.repository;
@@ -45,7 +40,7 @@ async function getOptionsFromGithub(options) {
45
40
  }
46
41
  const historicalRemoteConfigs = repo.defaultBranchRef.target.history.edges;
47
42
  const latestRemoteConfig = historicalRemoteConfigs[0]?.remoteConfig;
48
- const skipRemoteConfig = await getSkipRemoteConfigFile(options.skipRemoteConfig, latestRemoteConfig);
43
+ const skipRemoteConfig = await getSkipRemoteConfigFile(options.cwd, options.skipRemoteConfig, latestRemoteConfig);
49
44
  return {
50
45
  authenticatedUsername: res.viewer.login,
51
46
  sourceBranch: repo.defaultBranchRef.name,
@@ -56,7 +51,7 @@ async function getOptionsFromGithub(options) {
56
51
  };
57
52
  }
58
53
  exports.getOptionsFromGithub = getOptionsFromGithub;
59
- async function getSkipRemoteConfigFile(skipRemoteConfig, remoteConfig) {
54
+ async function getSkipRemoteConfigFile(cwd, skipRemoteConfig, remoteConfig) {
60
55
  if (skipRemoteConfig) {
61
56
  logger_1.logger.info('Skipping remote config: `--skip-remote-config` specified via config file or cli');
62
57
  return true;
@@ -65,23 +60,25 @@ async function getSkipRemoteConfigFile(skipRemoteConfig, remoteConfig) {
65
60
  logger_1.logger.info("Skipping remote config: remote config doesn't exist");
66
61
  return true;
67
62
  }
68
- const [isLocalConfigModified, isLocalConfigUntracked, localCommitDate] = await Promise.all([
69
- (0, git_1.isLocalConfigFileModified)(),
70
- (0, git_1.isLocalConfigFileUntracked)(),
71
- (0, git_1.getLocalConfigFileCommitDate)(),
72
- ]);
73
- if (isLocalConfigUntracked) {
74
- logger_1.logger.info('Skipping remote config: local config is new');
75
- return true;
76
- }
77
- if (isLocalConfigModified) {
78
- logger_1.logger.info('Skipping remote config: local config is modified');
79
- return true;
80
- }
81
- if (localCommitDate &&
82
- localCommitDate > Date.parse(remoteConfig.committedDate)) {
83
- logger_1.logger.info(`Skipping remote config: local config is newer: ${new Date(localCommitDate).toISOString()} > ${remoteConfig.committedDate}`);
84
- return true;
63
+ if (cwd) {
64
+ const [isLocalConfigModified, isLocalConfigUntracked, localCommitDate] = await Promise.all([
65
+ (0, git_1.isLocalConfigFileModified)({ cwd }),
66
+ (0, git_1.isLocalConfigFileUntracked)({ cwd }),
67
+ (0, git_1.getLocalConfigFileCommitDate)({ cwd }),
68
+ ]);
69
+ if (isLocalConfigUntracked) {
70
+ logger_1.logger.info('Skipping remote config: local config is new');
71
+ return true;
72
+ }
73
+ if (isLocalConfigModified) {
74
+ logger_1.logger.info('Skipping remote config: local config is modified');
75
+ return true;
76
+ }
77
+ if (localCommitDate &&
78
+ localCommitDate > Date.parse(remoteConfig.committedDate)) {
79
+ logger_1.logger.info(`Skipping remote config: local config is newer: ${new Date(localCommitDate).toISOString()} > ${remoteConfig.committedDate}`);
80
+ return true;
81
+ }
85
82
  }
86
83
  return false;
87
84
  }
@@ -118,13 +115,15 @@ function getHistoricalBranchLabelMappings(historicalRemoteConfigs) {
118
115
  })
119
116
  .filter(filterEmpty_1.filterNil);
120
117
  }
121
- function handleMissingConfigFile(error) {
122
- const wasMissingConfigError = error.response?.data.errors?.some((error) => error.type === 'NOT_FOUND' &&
118
+ function swallowErrorIfConfigFileIsMissing(error) {
119
+ const { data, errors } = error.axiosResponse.data;
120
+ const wasMissingConfigError = errors?.some((error) => error.type === 'NOT_FOUND' &&
123
121
  error.path.join('.') ===
124
122
  'repository.defaultBranchRef.target.history.edges.0.remoteConfig.file');
125
- // Throw unexpected error
126
- if (!wasMissingConfigError || !error.response?.data.data) {
127
- throw (0, apiRequestV4_1.handleGithubV4Error)(error);
123
+ // swallow error if it's just the config file that's missing
124
+ if (wasMissingConfigError && data != null) {
125
+ return data;
128
126
  }
129
- return error.response.data.data;
127
+ // Throw unexpected error
128
+ throw error;
130
129
  }
@@ -6,7 +6,7 @@ export declare type RemoteConfig = {
6
6
  };
7
7
  };
8
8
  };
9
- export declare type Repository = {
9
+ declare type Repository = {
10
10
  ref: {
11
11
  name: string;
12
12
  } | null;
@@ -35,3 +35,4 @@ export interface GithubConfigOptionsResponse {
35
35
  } & Repository);
36
36
  }
37
37
  export declare const query = "\n query GithubConfigOptions($repoOwner: String!, $repoName: String!) {\n viewer {\n login\n }\n repository(owner: $repoOwner, name: $repoName) {\n isFork\n ...Repo\n parent {\n ...Repo\n }\n }\n }\n\n fragment Repo on Repository {\n # check to see if a branch named \"backport\" exists\n ref(qualifiedName: \"refs/heads/backport\") {\n name\n }\n defaultBranchRef {\n name\n target {\n ... on Commit {\n history(first: 20, path: \".backportrc.json\") {\n edges {\n remoteConfig: node {\n committedDate\n file(path: \".backportrc.json\") {\n ... on TreeEntry {\n object {\n ... on Blob {\n text\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n";
38
+ export {};
@@ -0,0 +1,29 @@
1
+ export declare function getRepoOwnerAndNameFromGitRemotes({ accessToken, githubApiBaseUrlV4, cwd, }: {
2
+ accessToken: string;
3
+ githubApiBaseUrlV4?: string;
4
+ cwd: string;
5
+ }): Promise<{
6
+ repoOwner?: string;
7
+ repoName?: string;
8
+ }>;
9
+ export interface RepoOwnerAndNameResponse {
10
+ repository: {
11
+ isFork: true;
12
+ name: string;
13
+ owner: {
14
+ login: string;
15
+ };
16
+ parent: {
17
+ owner: {
18
+ login: string;
19
+ };
20
+ };
21
+ } | {
22
+ isFork: false;
23
+ name: string;
24
+ owner: {
25
+ login: string;
26
+ };
27
+ parent: null;
28
+ };
29
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRepoOwnerAndNameFromGitRemotes = void 0;
4
+ const maybe_1 = require("../../../utils/maybe");
5
+ const git_1 = require("../../git");
6
+ const logger_1 = require("../../logger");
7
+ const apiRequestV4_1 = require("./apiRequestV4");
8
+ async function getRepoOwnerAndNameFromGitRemotes({ accessToken, githubApiBaseUrlV4, cwd, }) {
9
+ const remotes = await (0, git_1.getRepoInfoFromGitRemotes)({ cwd });
10
+ const firstRemote = (0, maybe_1.maybe)(remotes[0]);
11
+ if (!firstRemote) {
12
+ return {};
13
+ }
14
+ try {
15
+ const res = await (0, apiRequestV4_1.apiRequestV4)({
16
+ githubApiBaseUrlV4,
17
+ accessToken,
18
+ query,
19
+ variables: {
20
+ repoOwner: firstRemote.repoOwner,
21
+ repoName: firstRemote.repoName,
22
+ },
23
+ });
24
+ return {
25
+ repoName: res.repository.name,
26
+ // get the original owner (not the fork owner)
27
+ repoOwner: res.repository.isFork
28
+ ? res.repository.parent.owner.login
29
+ : res.repository.owner.login,
30
+ };
31
+ }
32
+ catch (e) {
33
+ if (e instanceof apiRequestV4_1.GithubV4Exception) {
34
+ logger_1.logger.error(e.message);
35
+ return {};
36
+ }
37
+ throw e;
38
+ }
39
+ }
40
+ exports.getRepoOwnerAndNameFromGitRemotes = getRepoOwnerAndNameFromGitRemotes;
41
+ const query = /* GraphQL */ `
42
+ query RepoOwnerAndName($repoOwner: String!, $repoName: String!) {
43
+ repository(owner: $repoOwner, name: $repoName) {
44
+ isFork
45
+ name
46
+ owner {
47
+ login
48
+ }
49
+ parent {
50
+ owner {
51
+ login
52
+ }
53
+ }
54
+ }
55
+ }
56
+ `;
@@ -1,7 +1,6 @@
1
- import { AxiosError } from 'axios';
2
- import { GithubV4Response } from './apiRequestV4';
3
- export declare function throwOnInvalidAccessToken({ repoOwner, repoName, error, }: {
1
+ import { GithubV4Exception } from './apiRequestV4';
2
+ export declare function throwOnInvalidAccessToken({ error, repoOwner, repoName, }: {
3
+ error: GithubV4Exception<unknown>;
4
4
  repoOwner: string;
5
5
  repoName: string;
6
- error: AxiosError<GithubV4Response<unknown>>;
7
- }): void;
6
+ }): undefined;
@@ -2,22 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.throwOnInvalidAccessToken = void 0;
4
4
  const lodash_1 = require("lodash");
5
+ const maybe_1 = require("../../../utils/maybe");
5
6
  const HandledError_1 = require("../../HandledError");
6
7
  const env_1 = require("../../env");
7
- function throwOnInvalidAccessToken({ repoOwner, repoName, error, }) {
8
+ function throwOnInvalidAccessToken({ error, repoOwner, repoName, }) {
8
9
  function getSSOAuthUrl(ssoHeader) {
9
10
  const matches = ssoHeader?.match(/url=(.*)/);
10
11
  if (matches) {
11
12
  return matches[1];
12
13
  }
13
14
  }
14
- const statusCode = error.response?.status;
15
+ const statusCode = error.axiosResponse.status;
15
16
  switch (statusCode) {
16
17
  case 200: {
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'];
18
+ const repoNotFound = error.axiosResponse.data.errors?.some((error) => error.type === 'NOT_FOUND' && error.path.join('.') === 'repository');
19
+ const grantedScopes = error.axiosResponse.headers['x-oauth-scopes'] || '';
20
+ const requiredScopes = error.axiosResponse.headers['x-accepted-oauth-scopes'] || '';
21
+ const ssoHeader = (0, maybe_1.maybe)(error.axiosResponse.headers['x-github-sso']);
21
22
  if (repoNotFound) {
22
23
  const hasRequiredScopes = (0, lodash_1.isEmpty)((0, lodash_1.difference)(requiredScopes.split(','), grantedScopes.split(',')));
23
24
  // user does not have permission to the repo
@@ -27,7 +28,7 @@ function throwOnInvalidAccessToken({ repoOwner, repoName, error, }) {
27
28
  // repo does not exist
28
29
  throw new HandledError_1.HandledError(`The repository "${repoOwner}/${repoName}" doesn't exist`);
29
30
  }
30
- const repoAccessForbidden = error.response?.data.errors?.some((error) => error.type === 'FORBIDDEN');
31
+ const repoAccessForbidden = error.axiosResponse.data.errors?.some((error) => error.type === 'FORBIDDEN');
31
32
  const ssoAuthUrl = getSSOAuthUrl(ssoHeader);
32
33
  // user does not have permissions
33
34
  if (repoAccessForbidden && ssoAuthUrl) {
@@ -37,6 +38,8 @@ function throwOnInvalidAccessToken({ repoOwner, repoName, error, }) {
37
38
  }
38
39
  case 401:
39
40
  throw new HandledError_1.HandledError(`Please check your access token and make sure it is valid.\nConfig: ${(0, env_1.getGlobalConfigPath)()}`);
41
+ default:
42
+ return undefined;
40
43
  }
41
44
  }
42
45
  exports.throwOnInvalidAccessToken = throwOnInvalidAccessToken;
@@ -1,4 +1,3 @@
1
- import { ConfigFileOptions } from '../options/ConfigOptions';
2
1
  export declare function consoleLog(message: string): void;
3
2
  export declare type Logger = typeof logger;
4
3
  export declare const logger: {
@@ -8,9 +7,15 @@ export declare const logger: {
8
7
  verbose: (message: string, meta?: unknown) => void;
9
8
  debug: (message: string, meta?: unknown) => void;
10
9
  };
11
- export declare function updateLogger(options: ConfigFileOptions): void;
12
- export declare function redactAccessToken(str: string): string;
13
- export declare function initLogger(): {
10
+ export declare function updateLogger({ accessToken, verbose, }: {
11
+ accessToken: string;
12
+ verbose?: boolean;
13
+ }): void;
14
+ export declare function initLogger({ ci, accessToken, logFilePath, }: {
15
+ ci?: boolean;
16
+ accessToken?: string;
17
+ logFilePath?: string;
18
+ }): {
14
19
  error: (message: string, meta?: unknown) => void;
15
20
  warn: (message: string, meta?: unknown) => void;
16
21
  info: (message: string, meta?: unknown) => void;
@@ -22,11 +22,12 @@ 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.redactAccessToken = exports.updateLogger = exports.logger = exports.consoleLog = void 0;
25
+ exports.initLogger = exports.updateLogger = exports.logger = exports.consoleLog = void 0;
26
26
  const dedent_1 = __importDefault(require("dedent"));
27
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
+ const redact_1 = require("../utils/redact");
30
31
  const env_1 = require("./env");
31
32
  const { combine } = winston_1.format;
32
33
  let winstonInstance;
@@ -54,51 +55,30 @@ exports.logger = {
54
55
  winstonInstance.debug(message, null, { meta });
55
56
  },
56
57
  };
57
- let accessToken;
58
- function updateLogger(options) {
59
- accessToken = options.accessToken;
58
+ let _accessToken;
59
+ function updateLogger({ accessToken, verbose, }) {
60
+ // set access token
61
+ _accessToken = accessToken;
60
62
  // set log level
61
- winstonInstance.level = options.verbose ? 'debug' : 'info';
62
- // output logs to console in ci env
63
- if (options.ci) {
64
- winstonInstance.add(new winston_1.default.transports.Console());
65
- }
63
+ winstonInstance.level = verbose ? 'debug' : 'info';
66
64
  }
67
65
  exports.updateLogger = updateLogger;
68
66
  function redactAccessToken(str) {
69
67
  // `redactAccessToken` might be called before access token is set
70
- if (accessToken) {
71
- return str.replace(new RegExp(accessToken, 'g'), '<REDACTED>');
68
+ if (_accessToken) {
69
+ return (0, redact_1.redact)(_accessToken, str);
72
70
  }
73
71
  return str;
74
72
  }
75
- exports.redactAccessToken = redactAccessToken;
76
- function initLogger() {
73
+ function initLogger({ ci, accessToken, logFilePath, }) {
74
+ const fileTransport = getFileTransport({ logFilePath });
75
+ if (accessToken) {
76
+ _accessToken = accessToken;
77
+ }
77
78
  winstonInstance = winston_1.default.createLogger({
78
- transports: [
79
- // log to file
80
- new winston_1.default.transports.File({
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
- fillExcept: ['message', 'level', 'timestamp', 'label'],
84
- }), winston_1.format.printf((info) => {
85
- // format without metadata
86
- if (!info.metadata.meta) {
87
- return redactAccessToken(`${info.timestamp}: ${info.message}`);
88
- }
89
- // format when metadata is a string
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
- }
93
- if (info.metadata.meta.stack) {
94
- return redactAccessToken(`${info.timestamp}: ${info.message}\n${info.metadata.meta.stack}\n`);
95
- }
96
- // format when metadata is an object
97
- return redactAccessToken(`${info.timestamp}: ${info.message}\n${(0, safe_json_stringify_1.default)(info.metadata.meta, null, 2)}\n`);
98
- })),
99
- filename: (0, env_1.getLogfilePath)(),
100
- }),
101
- ],
79
+ transports: ci
80
+ ? [fileTransport, new winston_1.default.transports.Console()]
81
+ : [fileTransport],
102
82
  });
103
83
  // wait exiting until logs have been flushed to disk
104
84
  winstonInstance.on('finish', () => {
@@ -107,6 +87,29 @@ function initLogger() {
107
87
  return exports.logger;
108
88
  }
109
89
  exports.initLogger = initLogger;
90
+ function getFileTransport({ logFilePath }) {
91
+ return new winston_1.default.transports.File({
92
+ level: 'debug',
93
+ format: combine(winston_1.format.splat(), winston_1.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston_1.default.format.metadata({
94
+ fillExcept: ['message', 'level', 'timestamp', 'label'],
95
+ }), winston_1.format.printf((info) => {
96
+ // format without metadata
97
+ if (!info.metadata.meta) {
98
+ return redactAccessToken(`${info.timestamp}: ${info.message}`);
99
+ }
100
+ // format when metadata is a string
101
+ if ((0, lodash_1.isString)(info.metadata.meta)) {
102
+ return redactAccessToken(`${info.timestamp}: ${info.message}\n${(0, dedent_1.default)(info.metadata.meta)}\n`);
103
+ }
104
+ if (info.metadata.meta.stack) {
105
+ return redactAccessToken(`${info.timestamp}: ${info.message}\n${info.metadata.meta.stack}\n`);
106
+ }
107
+ // format when metadata is an object
108
+ return redactAccessToken(`${info.timestamp}: ${info.message}\n${(0, safe_json_stringify_1.default)(info.metadata.meta, null, 2)}\n`);
109
+ })),
110
+ filename: (0, env_1.getLogfilePath)({ logFilePath }),
111
+ });
112
+ }
110
113
  // log levels:
111
114
  // - error
112
115
  // - warn
@@ -75,19 +75,21 @@ function getChoicesForCommitPrompt(commits, showDetails) {
75
75
  const position = chalk_1.default.gray(`${i + 1}.${leadingWhitespace}`);
76
76
  let name;
77
77
  if (showDetails) {
78
- const message = (0, commitFormatters_1.stripPullNumber)(c.originalMessage);
79
- const prLink = c.pullUrl ? ` ` + getPrLink(c.pullNumber, c.pullUrl) : '';
80
- const detailsList = getDetailedPullStatus(c);
81
- name = `${position}${message}${prLink}${detailsList}`;
78
+ const message = (0, commitFormatters_1.stripPullNumber)(c.sourceCommit.message);
79
+ const prLink = c.sourcePullRequest
80
+ ? ` ` + getPrLink(c.sourcePullRequest.number, c.sourcePullRequest.url)
81
+ : '';
82
+ const pullStatus = getDetailedPullStatus(c);
83
+ name = `${position}${message}${prLink}${pullStatus}`;
82
84
  }
83
85
  else {
84
- const message = (0, commitFormatters_1.getFirstLine)(c.originalMessage);
85
- const pullStates = getSimplePullStatus(c);
86
- name = `${position}${message} ${pullStates}`;
86
+ const message = (0, commitFormatters_1.getFirstLine)(c.sourceCommit.message);
87
+ const pullStatus = getSimplePullStatus(c);
88
+ name = `${position}${message} ${pullStatus}`;
87
89
  }
88
- const short = c.pullNumber
89
- ? `#${c.pullNumber} (${(0, commitFormatters_1.getShortSha)(c.sha)})`
90
- : (0, commitFormatters_1.getShortSha)(c.sha);
90
+ const short = c.sourcePullRequest
91
+ ? `#${c.sourcePullRequest.number} (${(0, commitFormatters_1.getShortSha)(c.sourcePullRequest.mergeCommit.sha)})`
92
+ : (0, commitFormatters_1.getShortSha)(c.sourceCommit.sha);
91
93
  return { name, short, value: c };
92
94
  });
93
95
  }
@@ -54,7 +54,7 @@ function getExistingTargetPullRequests(sourceCommit, sourcePullRequest) {
54
54
  state: targetPullRequest.state,
55
55
  mergeCommit: targetPullRequest.targetMergeCommit
56
56
  ? {
57
- sha: targetPullRequest.targetMergeCommit.oid,
57
+ sha: targetPullRequest.targetMergeCommit.sha,
58
58
  message: targetPullRequest.targetMergeCommit.message,
59
59
  }
60
60
  : undefined,
@@ -10,7 +10,7 @@ function getMockSourceCommit({ sourceCommit, sourcePullRequest, timelineItems =
10
10
  owner: { login: 'elastic' },
11
11
  },
12
12
  committedDate: sourceCommit.commitedDate ?? '2021-12-22T00:00:00Z',
13
- oid: sourceCommit.sha ?? defaultSourceCommitSha,
13
+ sha: sourceCommit.sha ?? defaultSourceCommitSha,
14
14
  message: sourceCommit.message,
15
15
  };
16
16
  if (!sourcePullRequest) {
@@ -27,14 +27,14 @@ function getMockSourceCommit({ sourceCommit, sourcePullRequest, timelineItems =
27
27
  owner: { login: 'elastic' },
28
28
  },
29
29
  committedDate: sourceCommit.commitedDate ?? '2021-12-22T00:00:00Z',
30
- oid: sourceCommit.sha ?? defaultSourceCommitSha,
30
+ sha: sourceCommit.sha ?? defaultSourceCommitSha,
31
31
  message: sourceCommit.message,
32
32
  associatedPullRequests: {
33
33
  edges: [
34
34
  {
35
35
  node: {
36
- sourceMergeCommit: {
37
- oid: sourceCommit.sha ?? defaultSourceCommitSha,
36
+ mergeCommit: {
37
+ sha: sourceCommit.sha ?? defaultSourceCommitSha,
38
38
  message: sourceCommit.message,
39
39
  },
40
40
  url: `https://github.com/elastic/kibana/pull/${sourcePullRequest.number}`,
@@ -60,7 +60,7 @@ function getMockSourceCommit({ sourceCommit, sourcePullRequest, timelineItems =
60
60
  targetMergeCommit: timelineItem.state === 'MERGED'
61
61
  ? {
62
62
  message: timelineItem.commitMessages[0],
63
- oid: 'target-merge-commit-sha',
63
+ sha: 'target-merge-commit-sha',
64
64
  }
65
65
  : null,
66
66
  repository: {
@@ -73,7 +73,7 @@ function getMockSourceCommit({ sourceCommit, sourcePullRequest, timelineItems =
73
73
  edges: timelineItem.commitMessages.map((message) => ({
74
74
  node: {
75
75
  targetCommit: {
76
- oid: 'abc',
76
+ sha: 'abc',
77
77
  message: message,
78
78
  },
79
79
  },