backport 7.4.0 → 8.2.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 (244) hide show
  1. package/README.md +15 -16
  2. package/dist/backportRun.d.ts +12 -6
  3. package/dist/backportRun.js +64 -62
  4. package/dist/entrypoint.cli.js +4 -8
  5. package/dist/entrypoint.module.d.ts +13 -6
  6. package/dist/entrypoint.module.js +14 -20
  7. package/dist/entrypoint.module.private.test.js +47 -346
  8. package/dist/errors/BackportError.d.ts +19 -0
  9. package/dist/errors/BackportError.js +29 -0
  10. package/dist/lib/BackportError.d.ts +19 -0
  11. package/dist/lib/BackportError.js +29 -0
  12. package/dist/lib/cherrypickAndCreateTargetPullRequest.d.ts +11 -0
  13. package/dist/lib/cherrypickAndCreateTargetPullRequest.js +242 -0
  14. package/dist/lib/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
  15. package/dist/lib/cherrypickAndCreateTargetPullRequest.test.js +321 -0
  16. package/dist/lib/child-process-promisified.d.ts +25 -0
  17. package/dist/lib/child-process-promisified.js +60 -0
  18. package/dist/lib/env.d.ts +9 -0
  19. package/dist/lib/env.js +33 -0
  20. package/dist/lib/env.test.d.ts +1 -0
  21. package/dist/lib/env.test.js +26 -0
  22. package/dist/lib/getCommits.d.ts +2 -0
  23. package/dist/lib/getCommits.js +75 -0
  24. package/dist/lib/getCommitsWithoutBackports.d.ts +11 -0
  25. package/dist/lib/getCommitsWithoutBackports.js +68 -0
  26. package/dist/lib/getCommitsWithoutBackports.test.d.ts +1 -0
  27. package/dist/lib/getCommitsWithoutBackports.test.js +335 -0
  28. package/dist/lib/getGitConfigAuthor.d.ts +6 -0
  29. package/dist/lib/getGitConfigAuthor.js +15 -0
  30. package/dist/lib/getTargetBranches.d.ts +5 -0
  31. package/dist/lib/getTargetBranches.js +67 -0
  32. package/dist/lib/getTargetBranches.test.d.ts +1 -0
  33. package/dist/lib/getTargetBranches.test.js +210 -0
  34. package/dist/lib/git.d.ts +77 -0
  35. package/dist/lib/git.js +439 -0
  36. package/dist/lib/git.private.test.d.ts +1 -0
  37. package/dist/lib/git.private.test.js +618 -0
  38. package/dist/lib/git.test.d.ts +1 -0
  39. package/dist/lib/git.test.js +580 -0
  40. package/dist/lib/github/commitFormatters.d.ts +3 -0
  41. package/dist/lib/github/commitFormatters.js +17 -0
  42. package/dist/lib/github/commitFormatters.test.d.ts +1 -0
  43. package/dist/lib/github/commitFormatters.test.js +11 -0
  44. package/dist/lib/github/v3/addAssigneesToPullRequest.d.ts +2 -0
  45. package/dist/lib/github/v3/addAssigneesToPullRequest.js +32 -0
  46. package/dist/lib/github/v3/addAssigneesToPullRequest.test.d.ts +1 -0
  47. package/dist/lib/github/v3/addAssigneesToPullRequest.test.js +27 -0
  48. package/dist/lib/github/v3/addLabelsToPullRequest.d.ts +2 -0
  49. package/dist/lib/github/v3/addLabelsToPullRequest.js +30 -0
  50. package/dist/lib/github/v3/addReviewersToPullRequest.d.ts +2 -0
  51. package/dist/lib/github/v3/addReviewersToPullRequest.js +32 -0
  52. package/dist/lib/github/v3/createPullRequest.d.ts +29 -0
  53. package/dist/lib/github/v3/createPullRequest.js +91 -0
  54. package/dist/lib/github/v3/createPullRequest.test.d.ts +1 -0
  55. package/dist/lib/github/v3/createPullRequest.test.js +377 -0
  56. package/dist/lib/github/v3/createStatusComment.d.ts +11 -0
  57. package/dist/lib/github/v3/createStatusComment.js +138 -0
  58. package/dist/lib/github/v3/createStatusComment.test.d.ts +1 -0
  59. package/dist/lib/github/v3/createStatusComment.test.js +566 -0
  60. package/dist/lib/github/v3/getGithubV3ErrorMessage.d.ts +14 -0
  61. package/dist/lib/github/v3/getGithubV3ErrorMessage.js +16 -0
  62. package/dist/lib/github/v4/FetchPullRequestId.d.ts +2 -0
  63. package/dist/lib/github/v4/FetchPullRequestId.js +36 -0
  64. package/dist/lib/github/v4/apiRequestV4.d.ts +31 -0
  65. package/dist/lib/github/v4/apiRequestV4.js +71 -0
  66. package/dist/lib/github/v4/apiRequestV4.test.d.ts +1 -0
  67. package/dist/lib/github/v4/apiRequestV4.test.js +109 -0
  68. package/dist/lib/github/v4/disablePullRequestAutoMerge.d.ts +2 -0
  69. package/dist/lib/github/v4/disablePullRequestAutoMerge.js +32 -0
  70. package/dist/lib/github/v4/enablePullRequestAutoMerge.d.ts +2 -0
  71. package/dist/lib/github/v4/enablePullRequestAutoMerge.js +50 -0
  72. package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.d.ts +1 -0
  73. package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.js +112 -0
  74. package/dist/lib/github/v4/fetchAuthorId.d.ts +10 -0
  75. package/dist/lib/github/v4/fetchAuthorId.js +28 -0
  76. package/dist/lib/github/v4/fetchAuthorId.private.test.d.ts +1 -0
  77. package/dist/lib/github/v4/fetchAuthorId.private.test.js +25 -0
  78. package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.d.ts +1 -0
  79. package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.js +93 -0
  80. package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +11 -0
  81. package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.js +58 -0
  82. package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +1 -0
  83. package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +136 -0
  84. package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.d.ts +11 -0
  85. package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.js +48 -0
  86. package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +1 -0
  87. package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.private.test.js +118 -0
  88. package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +29 -0
  89. package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.js +110 -0
  90. package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +1 -0
  91. package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +196 -0
  92. package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +1 -0
  93. package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +157 -0
  94. package/dist/lib/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +1 -0
  95. package/dist/lib/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +107 -0
  96. package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.d.ts +12 -0
  97. package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +69 -0
  98. package/dist/lib/github/v4/fetchExistingPullRequest.d.ts +9 -0
  99. package/dist/lib/github/v4/fetchExistingPullRequest.js +64 -0
  100. package/dist/lib/github/v4/fetchExistingPullRequest.private.test.d.ts +1 -0
  101. package/dist/lib/github/v4/fetchExistingPullRequest.private.test.js +44 -0
  102. package/dist/lib/github/v4/fetchPullRequestAutoMergeMethod.d.ts +2 -0
  103. package/dist/lib/github/v4/fetchPullRequestAutoMergeMethod.js +39 -0
  104. package/dist/lib/github/v4/fetchRemoteProjectConfig.d.ts +8 -0
  105. package/dist/lib/github/v4/fetchRemoteProjectConfig.js +49 -0
  106. package/dist/lib/github/v4/fetchRemoteProjectConfig.private.test.d.ts +1 -0
  107. package/dist/lib/github/v4/fetchRemoteProjectConfig.private.test.js +49 -0
  108. package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +72 -0
  109. package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +78 -0
  110. package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +1 -0
  111. package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +116 -0
  112. package/dist/lib/github/v4/getOptionsFromGithub/query.d.ts +16 -0
  113. package/dist/lib/github/v4/getOptionsFromGithub/query.js +29 -0
  114. package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +29 -0
  115. package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.js +61 -0
  116. package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.d.ts +1 -0
  117. package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +72 -0
  118. package/dist/lib/github/v4/mocks/commitsByAuthorMock.d.ts +2 -0
  119. package/dist/lib/github/v4/mocks/commitsByAuthorMock.js +176 -0
  120. package/dist/lib/github/v4/throwOnInvalidAccessToken.d.ts +7 -0
  121. package/dist/lib/github/v4/throwOnInvalidAccessToken.js +45 -0
  122. package/dist/lib/github/v4/throwOnInvalidAccessToken.test.d.ts +1 -0
  123. package/dist/lib/github/v4/throwOnInvalidAccessToken.test.js +87 -0
  124. package/dist/lib/github/v4/validateTargetBranches.d.ts +14 -0
  125. package/dist/lib/github/v4/validateTargetBranches.js +46 -0
  126. package/dist/lib/github/v4/validateTargetBranches.private.test.d.ts +1 -0
  127. package/dist/lib/github/v4/validateTargetBranches.private.test.js +51 -0
  128. package/dist/lib/logger.d.ts +11 -0
  129. package/dist/lib/logger.js +80 -0
  130. package/dist/lib/ora.d.ts +2 -0
  131. package/dist/lib/ora.js +21 -0
  132. package/dist/lib/prompt.test.d.ts +1 -0
  133. package/dist/lib/prompt.test.js +139 -0
  134. package/dist/lib/prompts.d.ts +17 -0
  135. package/dist/lib/prompts.js +132 -0
  136. package/dist/lib/remoteConfig.d.ts +20 -0
  137. package/dist/lib/remoteConfig.js +52 -0
  138. package/dist/lib/sequentially.d.ts +1 -0
  139. package/dist/lib/sequentially.js +10 -0
  140. package/dist/lib/setupRepo.d.ts +2 -0
  141. package/dist/lib/setupRepo.js +56 -0
  142. package/dist/lib/setupRepo.test.d.ts +1 -0
  143. package/dist/lib/setupRepo.test.js +278 -0
  144. package/dist/lib/sourceCommit/getExpectedTargetPullRequests.d.ts +16 -0
  145. package/dist/lib/sourceCommit/getExpectedTargetPullRequests.js +102 -0
  146. package/dist/lib/sourceCommit/getExpectedTargetPullRequests.test.d.ts +1 -0
  147. package/dist/lib/sourceCommit/getExpectedTargetPullRequests.test.js +467 -0
  148. package/dist/lib/sourceCommit/getMockSourceCommit.d.ts +26 -0
  149. package/dist/lib/sourceCommit/getMockSourceCommit.js +103 -0
  150. package/dist/lib/sourceCommit/parseSourceCommit.d.ts +108 -0
  151. package/dist/lib/sourceCommit/parseSourceCommit.js +123 -0
  152. package/dist/lib/sourceCommit/parseSourceCommit.test.d.ts +1 -0
  153. package/dist/lib/sourceCommit/parseSourceCommit.test.js +226 -0
  154. package/dist/options/ConfigOptions.d.ts +4 -2
  155. package/dist/options/cliArgs.d.ts +14 -6
  156. package/dist/options/cliArgs.js +50 -22
  157. package/dist/options/cliArgs.test.js +128 -4
  158. package/dist/options/config/config.d.ts +5 -4
  159. package/dist/options/config/config.js +3 -5
  160. package/dist/options/config/config.test.js +0 -1
  161. package/dist/options/config/globalConfig.d.ts +5 -3
  162. package/dist/options/config/globalConfig.js +17 -14
  163. package/dist/options/config/readConfigFile.d.ts +5 -3
  164. package/dist/options/config/readConfigFile.js +2 -2
  165. package/dist/options/options.d.ts +41 -5
  166. package/dist/options/options.js +24 -24
  167. package/dist/options/options.test.js +117 -55
  168. package/dist/runSequentially.d.ts +14 -9
  169. package/dist/runSequentially.js +27 -12
  170. package/dist/scripts/postinstall.js +4 -3
  171. package/dist/scripts/postinstall.test.js +6 -2
  172. package/dist/services/BackportError.d.ts +19 -0
  173. package/dist/services/BackportError.js +29 -0
  174. package/dist/services/HandledBackportError.d.ts +19 -0
  175. package/dist/services/HandledBackportError.js +29 -0
  176. package/dist/services/HandledError.d.ts +2 -2
  177. package/dist/services/HandledError.js +7 -7
  178. package/dist/services/child-process-promisified.d.ts +19 -3
  179. package/dist/services/child-process-promisified.js +46 -17
  180. package/dist/services/git.d.ts +6 -7
  181. package/dist/services/git.integration.test.js +381 -65
  182. package/dist/services/git.js +189 -123
  183. package/dist/services/git.private.test.d.ts +1 -0
  184. package/dist/services/git.private.test.js +618 -0
  185. package/dist/services/git.test.js +167 -124
  186. package/dist/services/github/v3/addAssigneesToPullRequest.js +1 -1
  187. package/dist/services/github/v3/addLabelsToPullRequest.js +1 -1
  188. package/dist/services/github/v3/addReviewersToPullRequest.js +2 -1
  189. package/dist/services/github/v3/createPullRequest.js +4 -2
  190. package/dist/services/github/v3/createStatusComment.js +16 -17
  191. package/dist/services/github/v3/createStatusComment.test.js +20 -9
  192. package/dist/services/github/v4/apiRequestV4.js +2 -2
  193. package/dist/services/github/v4/apiRequestV4.test.js +2 -2
  194. package/dist/services/github/v4/enablePullRequestAutoMerge.js +2 -4
  195. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +4 -3
  196. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +5 -1
  197. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -2
  198. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +5 -1
  199. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +4 -3
  200. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +5 -1
  201. package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +3 -2
  202. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +2 -2
  203. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +5 -1
  204. package/dist/services/github/v4/throwOnInvalidAccessToken.js +5 -5
  205. package/dist/services/logger.js +5 -1
  206. package/dist/services/test.d.ts +1 -0
  207. package/dist/services/test.js +23 -0
  208. package/dist/state.d.ts +0 -0
  209. package/dist/state.js +1 -0
  210. package/dist/test/e2e/cli/commit-author.private.test.js +4 -4
  211. package/dist/test/e2e/cli/different-merge-strategies.private.test.js +27 -25
  212. package/dist/test/e2e/cli/entrypoint.cli.private.test.js +53 -75
  213. package/dist/test/e2e/cli/error-handling-interactive-mode.private.test.d.ts +1 -0
  214. package/dist/test/e2e/cli/error-handling-interactive-mode.private.test.js +80 -0
  215. package/dist/test/e2e/cli/error-handling-non-interactive-mode.private.test.d.ts +1 -0
  216. package/dist/test/e2e/cli/error-handling-non-interactive-mode.private.test.js +199 -0
  217. package/dist/test/e2e/cli/interactive-error-handling.private.test.d.ts +1 -0
  218. package/dist/test/e2e/cli/interactive-error-handling.private.test.js +80 -0
  219. package/dist/test/e2e/cli/non-interactive-error-handling.private.test.d.ts +1 -0
  220. package/dist/test/e2e/cli/non-interactive-error-handling.private.test.js +198 -0
  221. package/dist/test/e2e/cli/repo-with-backportrc-removed.private.test.js +28 -29
  222. package/dist/test/e2e/cli/runBackportViaCli.d.ts +6 -2
  223. package/dist/test/e2e/cli/runBackportViaCli.js +44 -23
  224. package/dist/test/e2e/cli/test-that-repo-can-be-cloned.private.test.js +22 -14
  225. package/dist/test/e2e/module/entrypoint.module.mutation.test.js +28 -21
  226. package/dist/test/handleUnbackportedPullRequests.private.test.js +11 -8
  227. package/dist/test/sandbox.js +5 -1
  228. package/dist/test/setupFiles/automatic-mocks.js +6 -2
  229. package/dist/ui/cherrypickAndCreateTargetPullRequest.js +4 -4
  230. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +7 -159
  231. package/dist/ui/getCommits.js +2 -2
  232. package/dist/ui/getCommitsWithoutBackports.test.js +5 -1
  233. package/dist/ui/getGitConfigAuthor.js +1 -1
  234. package/dist/ui/getTargetBranches.js +3 -3
  235. package/dist/ui/getTargetBranches.test.js +5 -1
  236. package/dist/ui/ora.d.ts +1 -8
  237. package/dist/ui/setupRepo.js +3 -3
  238. package/dist/ui/setupRepo.test.js +98 -61
  239. package/dist/utils/isErrnoError.d.ts +2 -0
  240. package/dist/utils/isErrnoError.js +7 -0
  241. package/dist/utils/packageVersion.d.ts +1 -1
  242. package/dist/utils/packageVersion.js +1 -1
  243. package/package.json +19 -19
  244. package/yarn.lock +472 -701
@@ -4,7 +4,7 @@ exports.getCommentBody = exports.createStatusComment = void 0;
4
4
  const rest_1 = require("@octokit/rest");
5
5
  const packageVersion_1 = require("../../../utils/packageVersion");
6
6
  const redact_1 = require("../../../utils/redact");
7
- const HandledError_1 = require("../../HandledError");
7
+ const BackportError_1 = require("../../BackportError");
8
8
  const logger_1 = require("../../logger");
9
9
  const commitFormatters_1 = require("../commitFormatters");
10
10
  async function createStatusComment({ options, backportResponse, }) {
@@ -32,7 +32,7 @@ async function createStatusComment({ options, backportResponse, }) {
32
32
  return;
33
33
  }
34
34
  return octokit.issues.createComment({
35
- baseUrl: options.githubApiBaseUrlV3,
35
+ baseUrl: githubApiBaseUrlV3,
36
36
  owner: repoOwner,
37
37
  repo: repoName,
38
38
  issue_number: commit.sourcePullRequest.number,
@@ -41,7 +41,7 @@ async function createStatusComment({ options, backportResponse, }) {
41
41
  }));
42
42
  }
43
43
  catch (e) {
44
- logger_1.logger.info(`Could not create status comment `, e.stack);
44
+ logger_1.logger.info(`Could not create status comment `, e);
45
45
  }
46
46
  }
47
47
  exports.createStatusComment = createStatusComment;
@@ -49,8 +49,8 @@ function getCommentBody({ options, pullNumber, backportResponse, }) {
49
49
  const { repoName, repoOwner, autoMerge } = options;
50
50
  // custom handling when running backport locally (as opposed to on CI)
51
51
  if (!options.ci) {
52
- // don't post comment when the overall process failed
53
- if (backportResponse.status === 'failure') {
52
+ // only post successful backports when not running in CI
53
+ if (backportResponse.status !== 'success') {
54
54
  return;
55
55
  }
56
56
  // only post a comment if all backports succeeded
@@ -60,15 +60,15 @@ function getCommentBody({ options, pullNumber, backportResponse, }) {
60
60
  }
61
61
  }
62
62
  const packageVersionSection = `\n<!--- Backport version: ${packageVersion_1.PACKAGE_VERSION} -->`;
63
- const manualBackportCommand = `\n### Manual backport\nTo create the backport manually run:\n\`\`\`\n${options.backportBinary} --pr ${pullNumber}\n\`\`\``;
64
- const questionsAndLinkToBackport = '\n\n### Questions ?\nPlease refer to the [Backport tool documentation](https://github.com/sqren/backport)';
65
- if (backportResponse.status === 'failure') {
66
- if (backportResponse.error instanceof HandledError_1.HandledError &&
67
- backportResponse.error.errorContext.code === 'no-branches-exception') {
68
- return `## ⚪ Backport skipped
63
+ const manualBackportCommand = `\n### Manual backport\nTo create the backport manually run:\n\`\`\`\n${options.backportBinary} --pr ${pullNumber}\n\`\`\`\n`;
64
+ const questionsAndLinkToBackport = '\n### Questions ?\nPlease refer to the [Backport tool documentation](https://github.com/sqren/backport)\n';
65
+ if (backportResponse.status === 'aborted' &&
66
+ backportResponse.error.errorContext.code === 'no-branches-exception') {
67
+ return `## ⚪ Backport skipped
69
68
  The pull request was not backported as there were no branches to backport to. If this is a mistake, please apply the desired version labels or run the backport tool manually.
70
69
  ${manualBackportCommand}${questionsAndLinkToBackport}${packageVersionSection}`;
71
- }
70
+ }
71
+ if (backportResponse.status !== 'success') {
72
72
  return `## 💔 Backport failed
73
73
  The pull request could not be backported due to the following error:
74
74
  \`${backportResponse.error.message}\`
@@ -87,7 +87,7 @@ ${manualBackportCommand}${questionsAndLinkToBackport}${packageVersionSection}`;
87
87
  `[<img src="https://img.shields.io/github/pulls/detail/state/${repoOwner}/${repoName}/${result.pullRequestNumber}">](${result.pullRequestUrl})`,
88
88
  ];
89
89
  }
90
- if (result.error instanceof HandledError_1.HandledError &&
90
+ if (result.error instanceof BackportError_1.BackportError &&
91
91
  result.error.errorContext.code === 'merge-conflict-exception') {
92
92
  const unmergedBackports = result.error.errorContext.commitsWithoutBackports.map((c) => {
93
93
  return ` - [${(0, commitFormatters_1.getFirstLine)(c.commit.sourceCommit.message)}](${c.commit.sourcePullRequest?.url})`;
@@ -106,7 +106,7 @@ ${manualBackportCommand}${questionsAndLinkToBackport}${packageVersionSection}`;
106
106
  .map((line) => line.join('|'))
107
107
  .join('|\n|');
108
108
  const table = backportResponse.results.length
109
- ? `| Status | Branch | Result |\n|:------:|:------:|:------|\n|${tableBody}|`
109
+ ? `\n\n| Status | Branch | Result |\n|:------:|:------:|:------|\n|${tableBody}|\n`
110
110
  : '';
111
111
  const didAllBackportsSucceed = backportResponse.results.every((r) => r.status === 'success');
112
112
  const didAnyBackportsSucceed = backportResponse.results.some((r) => r.status === 'success');
@@ -121,12 +121,11 @@ ${manualBackportCommand}${questionsAndLinkToBackport}${packageVersionSection}`;
121
121
  header = '## 💔 All backports failed';
122
122
  }
123
123
  const autoMergeMessage = autoMerge && didAnyBackportsSucceed
124
- ? '\nNote: Successful backport PRs will be merged automatically after passing CI.'
124
+ ? '\nNote: Successful backport PRs will be merged automatically after passing CI.\n'
125
125
  : '';
126
126
  const backportPRCommandMessage = !didAllBackportsSucceed
127
127
  ? `${manualBackportCommand}`
128
128
  : '';
129
- return `${header}\n\n${table}
130
- ${backportPRCommandMessage}${autoMergeMessage}${questionsAndLinkToBackport}${packageVersionSection}`;
129
+ return `${header}${table}${autoMergeMessage}${backportPRCommandMessage}${questionsAndLinkToBackport}${packageVersionSection}`;
131
130
  }
132
131
  exports.getCommentBody = getCommentBody;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const nock_1 = __importDefault(require("nock"));
7
- const HandledError_1 = require("../../HandledError");
7
+ const BackportError_1 = require("../../BackportError");
8
8
  const createStatusComment_1 = require("./createStatusComment");
9
9
  describe('createStatusComment', () => {
10
10
  it('redacts accessToken if it is included in the error message', async () => {
@@ -65,6 +65,7 @@ describe('getCommentBody', () => {
65
65
 
66
66
  ### Questions ?
67
67
  Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
68
+
68
69
  <!--- Backport version: 1.2.3-mocked -->"
69
70
  `);
70
71
  });
@@ -114,6 +115,7 @@ describe('getCommentBody', () => {
114
115
 
115
116
  ### Questions ?
116
117
  Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
118
+
117
119
  <!--- Backport version: 1.2.3-mocked -->"
118
120
  `);
119
121
  });
@@ -131,6 +133,7 @@ describe('getCommentBody', () => {
131
133
 
132
134
  ### Questions ?
133
135
  Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
136
+
134
137
  <!--- Backport version: 1.2.3-mocked -->"
135
138
  `);
136
139
  });
@@ -149,12 +152,12 @@ describe('getCommentBody', () => {
149
152
  status: 'success',
150
153
  results: [
151
154
  {
152
- status: 'failure',
155
+ status: 'unhandled-error',
153
156
  targetBranch: '7.x',
154
157
  error: new Error('My boom error!'),
155
158
  },
156
159
  {
157
- status: 'failure',
160
+ status: 'unhandled-error',
158
161
  targetBranch: '7.1',
159
162
  error: new Error('My boom error!'),
160
163
  },
@@ -179,6 +182,7 @@ describe('getCommentBody', () => {
179
182
 
180
183
  ### Questions ?
181
184
  Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
185
+
182
186
  <!--- Backport version: 1.2.3-mocked -->"
183
187
  `);
184
188
  });
@@ -224,15 +228,17 @@ describe('getCommentBody', () => {
224
228
  |✅|7.x|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/55\\">](url-to-pr-55)|
225
229
  |❌|7.1|My boom error!|
226
230
 
231
+ Note: Successful backport PRs will be merged automatically after passing CI.
232
+
227
233
  ### Manual backport
228
234
  To create the backport manually run:
229
235
  \`\`\`
230
236
  node scripts/backport --pr 55
231
237
  \`\`\`
232
- Note: Successful backport PRs will be merged automatically after passing CI.
233
238
 
234
239
  ### Questions ?
235
240
  Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
241
+
236
242
  <!--- Backport version: 1.2.3-mocked -->"
237
243
  `);
238
244
  });
@@ -263,7 +269,7 @@ describe('getCommentBody', () => {
263
269
  {
264
270
  status: 'failure',
265
271
  targetBranch: '7.1',
266
- error: new HandledError_1.HandledError({
272
+ error: new BackportError_1.BackportError({
267
273
  code: 'merge-conflict-exception',
268
274
  conflictingFiles: ['readme.md'],
269
275
  commitsWithoutBackports: [
@@ -321,7 +327,7 @@ describe('getCommentBody', () => {
321
327
  {
322
328
  status: 'failure',
323
329
  targetBranch: '7.2',
324
- error: new HandledError_1.HandledError({
330
+ error: new BackportError_1.BackportError({
325
331
  code: 'merge-conflict-exception',
326
332
  conflictingFiles: ['my-file.txt'],
327
333
  commitsWithoutBackports: [],
@@ -341,15 +347,17 @@ describe('getCommentBody', () => {
341
347
  |❌|7.1|**Backport failed because of merge conflicts**<br><br>You might need to backport the following PRs to 7.1:<br> - [New Zealand commit message](url-to-pr-5)<br> - [Australia commit](url-to-pr-44)|
342
348
  |❌|7.2|**Backport failed because of merge conflicts**|
343
349
 
350
+ Note: Successful backport PRs will be merged automatically after passing CI.
351
+
344
352
  ### Manual backport
345
353
  To create the backport manually run:
346
354
  \`\`\`
347
355
  node scripts/backport --pr 55
348
356
  \`\`\`
349
- Note: Successful backport PRs will be merged automatically after passing CI.
350
357
 
351
358
  ### Questions ?
352
359
  Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
360
+
353
361
  <!--- Backport version: 1.2.3-mocked -->"
354
362
  `);
355
363
  });
@@ -369,8 +377,10 @@ describe('getCommentBody', () => {
369
377
  },
370
378
  pullNumber: 55,
371
379
  backportResponse: {
372
- status: 'failure',
373
- error: new HandledError_1.HandledError({ code: 'no-branches-exception' }),
380
+ status: 'aborted',
381
+ commits: [],
382
+ error: new BackportError_1.BackportError({ code: 'no-branches-exception' }),
383
+ errorMessage: 'my message',
374
384
  },
375
385
  });
376
386
  it('posts a comment when running on CI', () => {
@@ -387,6 +397,7 @@ describe('getCommentBody', () => {
387
397
 
388
398
  ### Questions ?
389
399
  Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
400
+
390
401
  <!--- Backport version: 1.2.3-mocked -->"
391
402
  `);
392
403
  });
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getQueryName = exports.GithubV4Exception = exports.apiRequestV4 = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
8
  const printer_1 = require("graphql/language/printer");
9
- const HandledError_1 = require("../../HandledError");
9
+ const BackportError_1 = require("../../BackportError");
10
10
  const logger_1 = require("../../logger");
11
11
  async function apiRequestV4({ githubApiBaseUrlV4 = 'https://api.github.com/graphql', accessToken, query, variables, }) {
12
12
  try {
@@ -57,7 +57,7 @@ class GithubV4Exception extends Error {
57
57
  .join(',');
58
58
  const message = `${errorMessage ?? githubMessage ?? 'Unknown error'} (Github API v4)`;
59
59
  super(message);
60
- Error.captureStackTrace(this, HandledError_1.HandledError);
60
+ Error.captureStackTrace(this, BackportError_1.BackportError);
61
61
  this.name = 'GithubV4Exception';
62
62
  this.message = message;
63
63
  this.githubResponse = { ...githubResponse, request: undefined };
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const graphql_tag_1 = __importDefault(require("graphql-tag"));
7
7
  const nock_1 = __importDefault(require("nock"));
8
8
  const nockHelpers_1 = require("../../../test/nockHelpers");
9
- const HandledError_1 = require("../../HandledError");
9
+ const BackportError_1 = require("../../BackportError");
10
10
  const apiRequestV4_1 = require("./apiRequestV4");
11
11
  describe('apiRequestV4', () => {
12
12
  afterEach(() => {
@@ -78,7 +78,7 @@ describe('apiRequestV4', () => {
78
78
  variables: {
79
79
  foo: 'bar',
80
80
  },
81
- })).rejects.toThrowError(new HandledError_1.HandledError(`some error,some other error (Github API v4)`));
81
+ })).rejects.toThrowError(new BackportError_1.BackportError(`some error,some other error (Github API v4)`));
82
82
  });
83
83
  });
84
84
  describe('when request fails without error messages', () => {
@@ -43,10 +43,8 @@ async function enablePullRequestAutoMerge(options, targetPullRequestNumber) {
43
43
  return res.enablePullRequestAutoMerge.pullRequest?.number;
44
44
  }
45
45
  catch (e) {
46
- if (e instanceof Error) {
47
- spinner.fail();
48
- logger_1.logger.info(`Could not enable auto merging for ${targetPullRequestNumber}`, e.stack);
49
- }
46
+ spinner.fail();
47
+ logger_1.logger.info(`Could not enable auto merging for ${targetPullRequestNumber}`, e);
50
48
  }
51
49
  }
52
50
  exports.enablePullRequestAutoMerge = enablePullRequestAutoMerge;
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.fetchCommitByPullNumber = void 0;
7
7
  const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
- const HandledError_1 = require("../../../HandledError");
8
+ const BackportError_1 = require("../../../BackportError");
9
9
  const remoteConfig_1 = require("../../../remoteConfig");
10
10
  const parseSourceCommit_1 = require("../../../sourceCommit/parseSourceCommit");
11
11
  const apiRequestV4_1 = require("../apiRequestV4");
@@ -42,15 +42,16 @@ async function fetchCommitByPullNumber(options) {
42
42
  });
43
43
  }
44
44
  catch (e) {
45
+ //@ts-expect-error
45
46
  res = (0, remoteConfig_1.swallowMissingConfigFileException)(e);
46
47
  }
47
48
  const pullRequestNode = res.repository.pullRequest;
48
49
  if (!pullRequestNode) {
49
- throw new HandledError_1.HandledError(`The PR #${pullNumber} does not exist`);
50
+ throw new BackportError_1.BackportError(`The PR #${pullNumber} does not exist`);
50
51
  }
51
52
  const sourceCommit = pullRequestNode.mergeCommit;
52
53
  if (sourceCommit === null) {
53
- throw new HandledError_1.HandledError(`The PR #${pullNumber} is not merged`);
54
+ throw new BackportError_1.BackportError(`The PR #${pullNumber} is not merged`);
54
55
  }
55
56
  return (0, parseSourceCommit_1.parseSourceCommit)({ options, sourceCommit });
56
57
  }
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.fetchCommitBySha = void 0;
7
7
  const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
- const HandledError_1 = require("../../../HandledError");
8
+ const BackportError_1 = require("../../../BackportError");
9
9
  const remoteConfig_1 = require("../../../remoteConfig");
10
10
  const parseSourceCommit_1 = require("../../../sourceCommit/parseSourceCommit");
11
11
  const apiRequestV4_1 = require("../apiRequestV4");
@@ -36,11 +36,12 @@ async function fetchCommitBySha(options) {
36
36
  });
37
37
  }
38
38
  catch (e) {
39
+ //@ts-expect-error
39
40
  res = (0, remoteConfig_1.swallowMissingConfigFileException)(e);
40
41
  }
41
42
  const sourceCommit = res.repository.object;
42
43
  if (!sourceCommit) {
43
- throw new HandledError_1.HandledError(`No commit found on branch "${sourceBranch}" with sha "${sha}"`);
44
+ throw new BackportError_1.BackportError(`No commit found on branch "${sourceBranch}" with sha "${sha}"`);
44
45
  }
45
46
  return (0, parseSourceCommit_1.parseSourceCommit)({ options, sourceCommit });
46
47
  }
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -8,7 +8,7 @@ const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
8
  const lodash_1 = require("lodash");
9
9
  const filterEmpty_1 = require("../../../../utils/filterEmpty");
10
10
  const filterUnmergedCommits_1 = require("../../../../utils/filterUnmergedCommits");
11
- const HandledError_1 = require("../../../HandledError");
11
+ const BackportError_1 = require("../../../BackportError");
12
12
  const remoteConfig_1 = require("../../../remoteConfig");
13
13
  const parseSourceCommit_1 = require("../../../sourceCommit/parseSourceCommit");
14
14
  const apiRequestV4_1 = require("../apiRequestV4");
@@ -70,6 +70,7 @@ async function fetchByCommitPath({ options, authorId, commitPath, }) {
70
70
  });
71
71
  }
72
72
  catch (e) {
73
+ //@ts-expect-error
73
74
  return (0, remoteConfig_1.swallowMissingConfigFileException)(e);
74
75
  }
75
76
  }
@@ -81,7 +82,7 @@ async function fetchCommitsByAuthor(options) {
81
82
  : commitPaths.map((commitPath) => fetchByCommitPath({ options, authorId, commitPath })));
82
83
  // we only need to check if the first item is `null` (if the first is `null` they all are)
83
84
  if (responses[0].repository.ref === null) {
84
- throw new HandledError_1.HandledError(`The upstream branch "${sourceBranch}" does not exist. Try specifying a different branch with "--source-branch <your-branch>"`);
85
+ throw new BackportError_1.BackportError(`The upstream branch "${sourceBranch}" does not exist. Try specifying a different branch with "--source-branch <your-branch>"`);
85
86
  }
86
87
  const commits = responses
87
88
  .flatMap((res) => {
@@ -97,7 +98,7 @@ async function fetchCommitsByAuthor(options) {
97
98
  const errorText = options.author
98
99
  ? `There are no commits by "${options.author}" in this repository${pathText}. Try with \`--all\` for commits by all users or \`--author=<username>\` for commits from a specific user`
99
100
  : `There are no commits in this repository${pathText}`;
100
- throw new HandledError_1.HandledError(errorText);
101
+ throw new BackportError_1.BackportError(errorText);
101
102
  }
102
103
  const commitsUnique = (0, lodash_1.uniqBy)(commits, (c) => c.sourceCommit.sha);
103
104
  const commitsSorted = (0, lodash_1.orderBy)(commitsUnique, (c) => c.sourceCommit.committedDate, 'desc');
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -7,7 +7,7 @@ exports.fetchPullRequestsBySearchQuery = void 0;
7
7
  const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
8
  const lodash_1 = require("lodash");
9
9
  const filterUnmergedCommits_1 = require("../../../../utils/filterUnmergedCommits");
10
- const HandledError_1 = require("../../../HandledError");
10
+ const BackportError_1 = require("../../../BackportError");
11
11
  const remoteConfig_1 = require("../../../remoteConfig");
12
12
  const parseSourceCommit_1 = require("../../../sourceCommit/parseSourceCommit");
13
13
  const apiRequestV4_1 = require("../apiRequestV4");
@@ -47,6 +47,7 @@ async function fetchPullRequestsBySearchQuery(options) {
47
47
  });
48
48
  }
49
49
  catch (e) {
50
+ //@ts-expect-error
50
51
  res = (0, remoteConfig_1.swallowMissingConfigFileException)(e);
51
52
  }
52
53
  const commits = res.search.nodes.map((pullRequestNode) => {
@@ -58,7 +59,7 @@ async function fetchPullRequestsBySearchQuery(options) {
58
59
  const errorText = author
59
60
  ? `No commits found for query:\n ${searchQuery}\n\nUse \`--all\` to see commits by all users or \`--author=<username>\` for commits from a specific user`
60
61
  : `No commits found for query:\n ${searchQuery}`;
61
- throw new HandledError_1.HandledError(errorText);
62
+ throw new BackportError_1.BackportError(errorText);
62
63
  }
63
64
  if (options.onlyMissing) {
64
65
  return commits.filter(filterUnmergedCommits_1.filterUnmergedCommits);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getOptionsFromGithub = void 0;
4
- const HandledError_1 = require("../../../HandledError");
4
+ const BackportError_1 = require("../../../BackportError");
5
5
  const git_1 = require("../../../git");
6
6
  const logger_1 = require("../../../logger");
7
7
  const remoteConfig_1 = require("../../../remoteConfig");
@@ -28,7 +28,7 @@ async function getOptionsFromGithub(options) {
28
28
  }
29
29
  // it is not possible to have a branch named "backport"
30
30
  if (res.repository.illegalBackportBranch) {
31
- throw new HandledError_1.HandledError('You must delete the branch "backport" to continue. See https://github.com/sqren/backport/issues/155 for details');
31
+ throw new BackportError_1.BackportError('You must delete the branch "backport" to continue. See https://github.com/sqren/backport/issues/155 for details');
32
32
  }
33
33
  const remoteConfig = await getRemoteConfigFileOptions(res, options.cwd, options.skipRemoteConfig);
34
34
  return {
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.throwOnInvalidAccessToken = void 0;
4
4
  const lodash_1 = require("lodash");
5
5
  const maybe_1 = require("../../../utils/maybe");
6
- const HandledError_1 = require("../../HandledError");
6
+ const BackportError_1 = require("../../BackportError");
7
7
  const env_1 = require("../../env");
8
8
  function throwOnInvalidAccessToken({ error, repoOwner, repoName, }) {
9
9
  function getSSOAuthUrl(ssoHeader) {
@@ -23,21 +23,21 @@ function throwOnInvalidAccessToken({ error, repoOwner, repoName, }) {
23
23
  const hasRequiredScopes = (0, lodash_1.isEmpty)((0, lodash_1.difference)(requiredScopes.split(','), grantedScopes.split(',')));
24
24
  // user does not have permission to the repo
25
25
  if (!hasRequiredScopes) {
26
- throw new HandledError_1.HandledError(`You do not have access to the repository "${repoOwner}/${repoName}". Please make sure your access token has the required scopes.\n\nRequired scopes: ${requiredScopes}\nAccess token scopes: ${grantedScopes}`);
26
+ throw new BackportError_1.BackportError(`You do not have access to the repository "${repoOwner}/${repoName}". Please make sure your access token has the required scopes.\n\nRequired scopes: ${requiredScopes}\nAccess token scopes: ${grantedScopes}`);
27
27
  }
28
28
  // repo does not exist
29
- throw new HandledError_1.HandledError(`The repository "${repoOwner}/${repoName}" doesn't exist`);
29
+ throw new BackportError_1.BackportError(`The repository "${repoOwner}/${repoName}" doesn't exist`);
30
30
  }
31
31
  const repoAccessForbidden = error.githubResponse.data.errors?.some((error) => error.type === 'FORBIDDEN');
32
32
  const ssoAuthUrl = getSSOAuthUrl(ssoHeader);
33
33
  // user does not have permissions
34
34
  if (repoAccessForbidden && ssoAuthUrl) {
35
- throw new HandledError_1.HandledError(`Please follow the link to authorize your personal access token with SSO:\n\n${ssoAuthUrl}`);
35
+ throw new BackportError_1.BackportError(`Please follow the link to authorize your personal access token with SSO:\n\n${ssoAuthUrl}`);
36
36
  }
37
37
  break;
38
38
  }
39
39
  case 401:
40
- throw new HandledError_1.HandledError(`Please check your access token and make sure it is valid.\nConfig: ${(0, env_1.getGlobalConfigPath)()}`);
40
+ throw new BackportError_1.BackportError(`Please check your access token and make sure it is valid.\nConfig: ${(0, env_1.getGlobalConfigPath)()}`);
41
41
  default:
42
42
  return undefined;
43
43
  }
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
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
+ }
File without changes
package/dist/state.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const promises_1 = __importDefault(require("fs/promises"));
7
- const child_process_promisified_1 = require("../../../services/child-process-promisified");
7
+ const child_process_promisified_1 = require("../../../lib/child-process-promisified");
8
8
  const getDevAccessToken_1 = require("../../private/getDevAccessToken");
9
9
  const sandbox_1 = require("../../sandbox");
10
10
  const runBackportViaCli_1 = require("./runBackportViaCli");
@@ -50,7 +50,7 @@ describe('commit author', () => {
50
50
  '--branch=production',
51
51
  '--pr=2',
52
52
  '--dry-run',
53
- ], { waitForString: 'Dry run complete', cwd: sourceRepo, showOra: true });
53
+ ], { cwd: sourceRepo, showOra: true });
54
54
  const { authorEmail, authorName } = await getCommitAuthor({
55
55
  cwd: backportRepo,
56
56
  });
@@ -66,7 +66,7 @@ describe('commit author', () => {
66
66
  '--dry-run',
67
67
  '--gitAuthorName="Donald Duck"',
68
68
  '--gitAuthorEmail=duck@disney.com',
69
- ], { waitForString: 'Dry run complete', cwd: sourceRepo, showOra: true });
69
+ ], { cwd: sourceRepo, showOra: true });
70
70
  const { authorEmail, authorName } = await getCommitAuthor({
71
71
  cwd: backportRepo,
72
72
  });
@@ -81,7 +81,7 @@ describe('commit author', () => {
81
81
  '--pr=2',
82
82
  '--dry-run',
83
83
  '--reset-author',
84
- ], { waitForString: 'Dry run complete', cwd: sourceRepo, showOra: true });
84
+ ], { cwd: sourceRepo, showOra: true });
85
85
  const { authorEmail, authorName } = await getCommitAuthor({
86
86
  cwd: backportRepo,
87
87
  });