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
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const getDevAccessToken_1 = require("../../private/getDevAccessToken");
4
+ const sandbox_1 = require("../../sandbox");
5
+ const runBackportViaCli_1 = require("./runBackportViaCli");
6
+ const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
7
+ describe('interactive error handling', () => {
8
+ it('when branch is missing', async () => {
9
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
10
+ '--skip-remote-config',
11
+ '--repo=backport-org/backport-e2e',
12
+ `--accessToken=${accessToken}`,
13
+ ]);
14
+ expect(output).toMatchInlineSnapshot(`
15
+ "Please specify a target branch: \\"--branch 6.1\\".
16
+
17
+ Read more: https://github.com/sqren/backport/blob/main/docs/configuration.md#project-config-backportrcjson"
18
+ `);
19
+ });
20
+ it('when supplying invalid argument', async () => {
21
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([`--foo`]);
22
+ expect(output).toMatchInlineSnapshot(`
23
+ "Unknown argument: foo
24
+ Run \\"backport --help\\" to see all options"
25
+ `);
26
+ });
27
+ it('when access token is invalid', async () => {
28
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
29
+ '--branch=foo',
30
+ '--repo=foo/bar',
31
+ '--accessToken=some-token',
32
+ ]);
33
+ expect(output).toContain('Please check your access token and make sure it is valid');
34
+ });
35
+ it(`when repo doesn't exist`, async () => {
36
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
37
+ '--branch=foo',
38
+ '--repo=foo/bar',
39
+ '--author=sqren',
40
+ `--accessToken=${accessToken}`,
41
+ ]);
42
+ expect(output).toMatchInlineSnapshot(`"The repository \\"foo/bar\\" doesn't exist"`);
43
+ });
44
+ it(`when given branch is invalid`, async () => {
45
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
46
+ '--branch=foo',
47
+ '--repo=backport-org/backport-e2e',
48
+ '--pr=9',
49
+ `--accessToken=${accessToken}`,
50
+ ]);
51
+ expect(output).toMatchInlineSnapshot(`"The branch \\"foo\\" does not exist"`);
52
+ });
53
+ it(`when encountering conflicts`, async () => {
54
+ const backportDir = (0, sandbox_1.getSandboxPath)({ filename: __filename });
55
+ await (0, sandbox_1.resetSandbox)(backportDir);
56
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
57
+ '--repo=backport-org/repo-with-conflicts',
58
+ '--pr=12',
59
+ '--branch=7.x',
60
+ `--accessToken=${accessToken}`,
61
+ `--dir=${backportDir}`,
62
+ '--dry-run',
63
+ ], {
64
+ waitForString: 'Press ENTER when the conflicts',
65
+ timeoutSeconds: 5,
66
+ });
67
+ // //@ts-expect-error
68
+ // const lineToReplace = output.match(
69
+ // /Conflicting files:[\s]+- (.*[\s].*)la-liga.md/
70
+ // )[1];
71
+ // const lineWithoutBreaks = lineToReplace.replace(/\s/g, '');
72
+ // const outputReplaced = output
73
+ // .replace(lineToReplace, lineWithoutBreaks)
74
+ // .replaceAll(backportDir, '<BACKPORT_DIR>');
75
+ const outputReplaced = output
76
+ .replaceAll('\n', '')
77
+ .replaceAll(backportDir, '<BACKPORT_DIR>');
78
+ expect(outputReplaced).toMatchInlineSnapshot(`"Backporting to 7.x:The commit could not be backported due to conflictsPlease fix the conflicts in <BACKPORT_DIR>Hint: Before fixing the conflicts manually you should consider backporting the following pull requests to \\"7.x\\": - Change Barca to Braithwaite (#8) (backport missing) https://github.com/backport-org/repo-with-conflicts/pull/8? Fix the following conflicts manually:Conflicting files: - <BACKPORT_DIR>/la-liga.mdPress ENTER when the conflicts are resolved and files are staged (Y/n)"`);
79
+ });
80
+ });
@@ -0,0 +1,198 @@
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 promises_1 = __importDefault(require("fs/promises"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const getDevAccessToken_1 = require("../../private/getDevAccessToken");
9
+ const sandbox_1 = require("../../sandbox");
10
+ const runBackportViaCli_1 = require("./runBackportViaCli");
11
+ const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
12
+ describe('non interactive (json) error handling', () => {
13
+ it(`when access token is missing`, async () => {
14
+ const configFilePath = await createConfigFile({});
15
+ const { output, code } = await (0, runBackportViaCli_1.runBackportViaCli)([
16
+ '--json',
17
+ `--globalConfigFile=${configFilePath}`,
18
+ ]);
19
+ const backportResult = JSON.parse(output);
20
+ // remove absolute path to avoid issues on ci
21
+ const errorMessage = backportResult.errorMessage.replace(configFilePath, '<GLOBAL_CONFIG_FILE>');
22
+ expect(code).toBe(1);
23
+ expect(backportResult.status).toBe('failure');
24
+ expect(errorMessage).toMatchInlineSnapshot(`
25
+ "Please update your config file: \\"<GLOBAL_CONFIG_FILE>\\".
26
+ It must contain a valid \\"accessToken\\".
27
+
28
+ Read more: https://github.com/sqren/backport/blob/main/docs/configuration.md#global-config-backportconfigjson"
29
+ `);
30
+ });
31
+ it('when target branches cannot be inferred from pull request', async () => {
32
+ const { output, code } = await (0, runBackportViaCli_1.runBackportViaCli)([
33
+ '--json',
34
+ '--repo=backport-org/backport-e2e',
35
+ '--pr=9',
36
+ `--accessToken=${accessToken}`,
37
+ ]);
38
+ expect(code).toBe(0);
39
+ const backportResult = JSON.parse(output);
40
+ expect(backportResult.status).toBe('aborted');
41
+ expect(backportResult.error).toEqual({
42
+ errorContext: { code: 'no-branches-exception' },
43
+ name: 'BackportError',
44
+ });
45
+ expect(backportResult.errorMessage).toBe('There are no branches to backport to. Aborting.');
46
+ });
47
+ it(`when target branch and branch label mapping are missing`, async () => {
48
+ const { output, code } = await (0, runBackportViaCli_1.runBackportViaCli)([
49
+ '--json',
50
+ `--access-token=${accessToken}`,
51
+ ]);
52
+ expect(code).toBe(1);
53
+ const backportResult = JSON.parse(output);
54
+ expect(backportResult.status).toBe('failure');
55
+ expect(backportResult.errorMessage).toMatchInlineSnapshot(`
56
+ "Please specify a target branch: \\"--branch 6.1\\".
57
+
58
+ Read more: https://github.com/sqren/backport/blob/main/docs/configuration.md#project-config-backportrcjson"
59
+ `);
60
+ });
61
+ it(`when argument is invalid`, async () => {
62
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)(['--json', '--foo'], {});
63
+ const backportResult = JSON.parse(output);
64
+ expect(backportResult.status).toBe('failure');
65
+ expect(backportResult.errorMessage).toEqual('Unknown argument: foo');
66
+ });
67
+ it('when `--repo` is invalid', async () => {
68
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
69
+ '--json',
70
+ '--repo=backport-org/backport-e2e-foo',
71
+ `--accessToken=${accessToken}`,
72
+ ]);
73
+ const backportResult = JSON.parse(output);
74
+ expect(backportResult.status).toBe('failure');
75
+ expect(backportResult.errorMessage).toEqual('The repository "backport-org/backport-e2e-foo" doesn\'t exist');
76
+ });
77
+ it('when `--sha` is invalid', async () => {
78
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
79
+ '--json',
80
+ '--repo=backport-org/backport-e2e',
81
+ '--sha=abcdefg',
82
+ `--accessToken=${accessToken}`,
83
+ ]);
84
+ const backportResult = JSON.parse(output);
85
+ expect(backportResult.status).toBe('failure');
86
+ expect(backportResult.errorMessage).toEqual('No commit found on branch "master" with sha "abcdefg"');
87
+ });
88
+ it('when `--branch` is invalid', async () => {
89
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
90
+ '--json',
91
+ '--repo=backport-org/backport-e2e',
92
+ '--pr=9',
93
+ '--branch=foobar',
94
+ `--accessToken=${accessToken}`,
95
+ ]);
96
+ const backportResult = JSON.parse(output);
97
+ expect(backportResult.status).toBe('failure');
98
+ expect(backportResult.error).toEqual({
99
+ name: 'BackportError',
100
+ errorContext: {
101
+ code: 'message-only-exception',
102
+ message: 'The branch "foobar" does not exist',
103
+ },
104
+ });
105
+ });
106
+ it('when `--branch` tries to inject argument', async () => {
107
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
108
+ '--json',
109
+ '--repo=backport-org/backport-e2e',
110
+ '--pr=9',
111
+ '--branch=--foo bar',
112
+ `--accessToken=${accessToken}`,
113
+ ]);
114
+ const backportResult = JSON.parse(output);
115
+ expect(backportResult.status).toBe('failure');
116
+ expect(backportResult.error).toEqual({
117
+ name: 'BackportError',
118
+ errorContext: {
119
+ code: 'message-only-exception',
120
+ message: 'The branch "--foo bar" does not exist',
121
+ },
122
+ });
123
+ });
124
+ it('when `--pr` is invalid', async () => {
125
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
126
+ '--json',
127
+ '--repo=backport-org/backport-e2e',
128
+ '--pr=900',
129
+ '--branch=7.x',
130
+ `--accessToken=${accessToken}`,
131
+ ]);
132
+ const backportResult = JSON.parse(output);
133
+ expect(backportResult.status).toEqual('failure');
134
+ expect(backportResult.errorMessage).toEqual('Could not resolve to a PullRequest with the number of 900. (Github API v4)');
135
+ });
136
+ it('when encountering conflicts', async () => {
137
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
138
+ '--json',
139
+ '--repo=backport-org/repo-with-conflicts',
140
+ '--pr=12',
141
+ '--branch=7.x',
142
+ `--accessToken=${accessToken}`,
143
+ ]);
144
+ const backportResult = JSON.parse(output);
145
+ expect(backportResult.status).toEqual('success');
146
+ expect(
147
+ //@ts-expect-error
148
+ backportResult.results[0].error.errorContext.conflictingFiles).toEqual(['la-liga.md']);
149
+ });
150
+ it('when `--source-branch` is invalid', async () => {
151
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
152
+ '--json',
153
+ '--repo=backport-org/backport-e2e',
154
+ '--pr=9',
155
+ '--branch=7.x',
156
+ '--source-branch=foo',
157
+ `--accessToken=${accessToken}`,
158
+ ]);
159
+ const backportResult = JSON.parse(output);
160
+ expect(backportResult.status).toBe('success');
161
+ expect(backportResult.results[0]).toEqual({
162
+ error: {
163
+ context: {
164
+ cmdArgs: ['checkout', 'foo'],
165
+ code: 1,
166
+ stderr: "error: pathspec 'foo' did not match any file(s) known to git\n",
167
+ stdout: '',
168
+ },
169
+ name: 'SpawnError',
170
+ },
171
+ status: 'unhandled-error',
172
+ targetBranch: '7.x',
173
+ });
174
+ });
175
+ it('when attempting to backport unmerged PR', async () => {
176
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
177
+ '--json',
178
+ '--repo=backport-org/backport-e2e',
179
+ '--pr=12',
180
+ `--accessToken=${accessToken}`,
181
+ ]);
182
+ const backportResult = JSON.parse(output);
183
+ expect(backportResult.status).toBe('failure');
184
+ expect(backportResult.error).toEqual({
185
+ errorContext: {
186
+ code: 'message-only-exception',
187
+ message: 'The PR #12 is not merged',
188
+ },
189
+ name: 'BackportError',
190
+ });
191
+ });
192
+ });
193
+ async function createConfigFile(options) {
194
+ const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
195
+ const configPath = path_1.default.join(sandboxPath, 'config.json');
196
+ await promises_1.default.writeFile(configPath, JSON.stringify(options));
197
+ return configPath;
198
+ }
@@ -4,46 +4,45 @@ const getDevAccessToken_1 = require("../../private/getDevAccessToken");
4
4
  const runBackportViaCli_1 = require("./runBackportViaCli");
5
5
  const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
6
6
  describe('repo-with-backportrc-removed (missing .backportrc.json config file)', () => {
7
- it('should list commits', async () => {
8
- const output = await (0, runBackportViaCli_1.runBackportViaCli)([
9
- '--branch=foo',
7
+ it('lists commits', async () => {
8
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
9
+ '--branch=production',
10
10
  '--repo=backport-org/repo-with-backportrc-removed',
11
11
  `--accessToken=${accessToken}`,
12
12
  ], { waitForString: 'Select commit' });
13
13
  expect(output).toMatchInlineSnapshot(`
14
- "? Select commit (Use arrow keys)
15
- ❯ 1. Rename README.me to README.md
16
- 2. Merge pull request #1 from backport-org/add-readme
17
- 3. Create README.me
18
- 4. Delete .backportrc.json
19
- 5. Create .backportrc.json
20
- 6. Delete .backportrc.json
21
- 7. Create .backportrc.json"
22
- `);
14
+ "? Select commit (Use arrow keys)
15
+ ❯ 1. Rename README.me to README.md
16
+ 2. Merge pull request #1 from backport-org/add-readme
17
+ 3. Create README.me
18
+ 4. Delete .backportrc.json
19
+ 5. Create .backportrc.json
20
+ 6. Delete .backportrc.json
21
+ 7. Create .backportrc.json"
22
+ `);
23
23
  });
24
- it('should attempt to backport by PR', async () => {
25
- const output = await (0, runBackportViaCli_1.runBackportViaCli)([
26
- '--branch=foo',
24
+ it('backports via pr', async () => {
25
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
26
+ '--branch=production',
27
27
  '--repo=backport-org/repo-with-backportrc-removed',
28
28
  '--pr=1',
29
29
  `--accessToken=${accessToken}`,
30
- ], { waitForString: "is invalid or doesn't exist" });
31
- expect(output).toMatchInlineSnapshot(`
32
- "
33
- Backporting to foo:
34
- The branch \\"foo\\" is invalid or doesn't exist"
35
- `);
30
+ '--dry-run',
31
+ ], {
32
+ showOra: true,
33
+ });
34
+ expect(output).toContain('Cherry-picking: Merge pull request #1 from backport-org/add-readme');
36
35
  });
37
- it('should attempt to backport by commit sha', async () => {
38
- const output = await (0, runBackportViaCli_1.runBackportViaCli)([
39
- '--branch=foo',
36
+ it('backport by commit sha', async () => {
37
+ const { output } = await (0, runBackportViaCli_1.runBackportViaCli)([
38
+ '--branch=production',
40
39
  '--repo=backport-org/repo-with-backportrc-removed',
41
40
  '--sha=be59df6912a550c8cb49ba3e18be3e512f3d608c',
42
41
  `--accessToken=${accessToken}`,
43
- ], { waitForString: `Backporting to foo:` });
44
- expect(output).toMatchInlineSnapshot(`
45
- "
46
- Backporting to foo:"
47
- `);
42
+ '--dry-run',
43
+ ], {
44
+ showOra: true,
45
+ });
46
+ expect(output).toContain('Cherry-picking: Create README.me');
48
47
  });
49
48
  });
@@ -1,5 +1,9 @@
1
- export declare function runBackportViaCli(cliArgs: string[], { showOra, waitForString, cwd, }?: {
1
+ export declare function runBackportViaCli(backportArgs: string[], { timeoutSeconds, showOra, waitForString, cwd, }?: {
2
+ timeoutSeconds?: number;
2
3
  showOra?: boolean;
3
4
  waitForString?: string;
4
5
  cwd?: string;
5
- }): Promise<string>;
6
+ }): Promise<{
7
+ output: string;
8
+ code: number | null;
9
+ }>;
@@ -8,41 +8,62 @@ const child_process_1 = require("child_process");
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const lodash_1 = require("lodash");
10
10
  const strip_ansi_1 = __importDefault(require("strip-ansi"));
11
- const TIMEOUT_IN_SECONDS = 15;
12
- jest.setTimeout(TIMEOUT_IN_SECONDS * 1000);
13
- function runBackportViaCli(cliArgs, { showOra, waitForString, cwd, } = {}) {
11
+ const sandbox_1 = require("../../sandbox");
12
+ jest.setTimeout(15000);
13
+ function runBackportViaCli(backportArgs, { timeoutSeconds = 3, showOra, waitForString, cwd, } = {}) {
14
14
  const tsNodeBinary = path_1.default.resolve('./node_modules/.bin/ts-node');
15
15
  const entrypointFile = path_1.default.resolve('./src/entrypoint.cli.ts');
16
- const proc = (0, child_process_1.spawn)(tsNodeBinary, [
16
+ const randomString = Math.random().toString(36).slice(2);
17
+ const sandboxPath = (0, sandbox_1.getSandboxPath)({
18
+ filename: __filename,
19
+ specname: randomString,
20
+ });
21
+ (0, sandbox_1.resetSandbox)(sandboxPath);
22
+ const cmdArgs = [
17
23
  '--transpile-only',
18
24
  entrypointFile,
19
- '--log-file-path',
20
- '/dev/null',
21
- ...cliArgs,
22
- ], { cwd });
25
+ '--log-file-path=/dev/null',
26
+ ...(backportArgs.some((arg) => arg.includes('--dir'))
27
+ ? []
28
+ : [`--dir=${sandboxPath}`]),
29
+ ...backportArgs,
30
+ ];
31
+ const proc = (0, child_process_1.spawn)(tsNodeBinary, cmdArgs, { cwd });
23
32
  return new Promise((resolve, reject) => {
24
33
  let data = '';
25
- const timeoutSeconds = 2;
26
- const rejectOnTimeout = (0, lodash_1.debounce)(() => {
27
- reject(`Expectation '${waitForString}' not found within ${timeoutSeconds} second in:\n\n${data.toString()}`);
34
+ const postponeTimeout = (0, lodash_1.debounce)(() => {
35
+ const formattedData = formatData(data);
36
+ const cmd = [tsNodeBinary, ...cmdArgs].join(' ');
37
+ reject(waitForString
38
+ ? `Expectation '${waitForString}' not found within ${timeoutSeconds} second in:\n\n${formattedData}\n\nCommand: ${cmd}`
39
+ : `Timeout. Received:\n${formattedData}\n\nCommand: ${cmd}`);
28
40
  }, timeoutSeconds * 1000, { maxWait: 15000 });
29
- // fail if expectations hasn't been found within 10 seconds
41
+ function formatData(data) {
42
+ return (0, strip_ansi_1.default)(data.toString()).trim();
43
+ }
30
44
  const onChunk = (chunk) => {
31
45
  data += chunk;
32
- const stringfiedData = data.toString();
33
- rejectOnTimeout();
34
- // remove ansi codes and whitespace
35
- const output = (0, strip_ansi_1.default)(stringfiedData).replace(/\s+$/gm, '');
36
- if (!waitForString || output.includes(waitForString)) {
37
- rejectOnTimeout.cancel();
38
- resolve(output);
46
+ const output = formatData(data);
47
+ if (waitForString && output.includes(waitForString)) {
48
+ postponeTimeout.cancel();
49
+ resolve({ output, code: null });
39
50
  }
40
51
  };
41
- proc.stdout.on('data', onChunk);
52
+ proc.on('exit', (code) => {
53
+ postponeTimeout.cancel();
54
+ resolve({ output: formatData(data), code });
55
+ });
56
+ proc.stdout.on('data', (chunk) => {
57
+ postponeTimeout();
58
+ onChunk(chunk);
59
+ });
42
60
  // ora (loading spinner) is redirected to stderr
43
- if (showOra) {
44
- proc.stderr.on('data', onChunk);
45
- }
61
+ proc.stderr.on('data', (chunk) => {
62
+ postponeTimeout();
63
+ if (showOra) {
64
+ onChunk(chunk);
65
+ }
66
+ });
46
67
  proc.on('error', (err) => {
47
68
  reject(`runBackportViaCli failed with: ${err}`);
48
69
  });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const child_process_promisified_1 = require("../../../services/child-process-promisified");
3
+ const child_process_promisified_1 = require("../../../lib/child-process-promisified");
4
4
  const getDevAccessToken_1 = require("../../private/getDevAccessToken");
5
5
  const sandbox_1 = require("../../sandbox");
6
6
  const runBackportViaCli_1 = require("./runBackportViaCli");
@@ -15,30 +15,42 @@ describe('test-that-repo-can-be-cloned', () => {
15
15
  function run() {
16
16
  return (0, runBackportViaCli_1.runBackportViaCli)([
17
17
  '--repo=backport-org/test-that-repo-can-be-cloned',
18
- '--branch=foo',
18
+ '--branch=production',
19
19
  '--pr=1',
20
20
  `--dir=${sandboxPath}`,
21
21
  '--dry-run',
22
22
  `--accessToken=${accessToken}`,
23
- ], { showOra: true, waitForString: 'Backporting to foo:' });
23
+ ], { showOra: true });
24
24
  }
25
25
  it('clones the repo remote repo', async () => {
26
- const output = await run();
26
+ const { output } = await run();
27
27
  expect(output).toContain('Cloning repository from github.com');
28
28
  expect(output).toMatchInlineSnapshot(`
29
29
  "- Initializing...
30
30
  ? Select pull request Beginning of a beautiful repo (#1)
31
31
  ✔ 100% Cloning repository from github.com (one-time operation)
32
- Backporting to foo:"
32
+
33
+ Backporting to production:
34
+ - Pulling latest changes
35
+ ✔ Pulling latest changes
36
+ - Cherry-picking: Beginning of a beautiful repo (#1)
37
+ ✔ Cherry-picking: Beginning of a beautiful repo (#1)
38
+ ✔ Dry run complete"
33
39
  `);
34
40
  });
35
41
  it('does not clone again on subsequent runs', async () => {
36
- const output = await run();
42
+ const { output } = await run();
37
43
  expect(output).not.toContain('Cloning repository from github.com');
38
44
  expect(output).toMatchInlineSnapshot(`
39
45
  "- Initializing...
40
46
  ? Select pull request Beginning of a beautiful repo (#1)
41
- Backporting to foo:"
47
+
48
+ Backporting to production:
49
+ - Pulling latest changes
50
+ ✔ Pulling latest changes
51
+ - Cherry-picking: Beginning of a beautiful repo (#1)
52
+ ✔ Cherry-picking: Beginning of a beautiful repo (#1)
53
+ ✔ Dry run complete"
42
54
  `);
43
55
  });
44
56
  });
@@ -54,19 +66,15 @@ describe('test-that-repo-can-be-cloned', () => {
54
66
  });
55
67
  function run() {
56
68
  return (0, runBackportViaCli_1.runBackportViaCli)([
57
- '--branch=foo',
69
+ '--branch=production',
58
70
  '--pr=1',
59
71
  `--dir=${backportRepo}`,
60
72
  '--dry-run',
61
73
  `--accessToken=${accessToken}`,
62
- ], {
63
- cwd: sourceRepo,
64
- showOra: true,
65
- waitForString: 'Backporting to foo:',
66
- });
74
+ ], { cwd: sourceRepo, showOra: true });
67
75
  }
68
76
  it('clones using the local repo', async () => {
69
- const output = await run();
77
+ const { output } = await run();
70
78
  expect(output).toEqual(expect.stringMatching(/100% Cloning repository from .*\/src\/test\/_tmp_sandbox_\/test-that-repo-can-be-cloned.private.test\/source \(one-time operation\)/gm));
71
79
  });
72
80
  });
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const rest_1 = require("@octokit/rest");
4
4
  const entrypoint_module_1 = require("../../../entrypoint.module");
5
- const commitFormatters_1 = require("../../../services/github/commitFormatters");
5
+ const commitFormatters_1 = require("../../../lib/github/commitFormatters");
6
6
  const getDevAccessToken_1 = require("../../private/getDevAccessToken");
7
7
  const sandbox_1 = require("../../sandbox");
8
8
  jest.unmock('find-up');
9
9
  jest.unmock('del');
10
10
  jest.unmock('make-dir');
11
- jest.setTimeout(15000);
11
+ jest.setTimeout(10000);
12
12
  const accessToken = (0, getDevAccessToken_1.getDevAccessToken)();
13
13
  const octokit = new rest_1.Octokit({ auth: accessToken });
14
14
  const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
@@ -29,12 +29,14 @@ describe('entrypoint.module', () => {
29
29
  beforeAll(async () => {
30
30
  await resetState(accessToken);
31
31
  res = await (0, entrypoint_module_1.backportRun)({
32
- dir: sandboxPath,
33
- accessToken,
34
- repoOwner: 'backport-org',
35
- repoName: 'integration-test',
36
- sha: COMMIT_SHA_1,
37
- targetBranches: ['7.x'],
32
+ options: {
33
+ dir: sandboxPath,
34
+ accessToken,
35
+ repoOwner: 'backport-org',
36
+ repoName: 'integration-test',
37
+ sha: COMMIT_SHA_1,
38
+ targetBranches: ['7.x'],
39
+ },
38
40
  });
39
41
  // @ts-expect-error
40
42
  const pullRequestNumber = res.results[0].pullRequestNumber;
@@ -123,12 +125,14 @@ describe('entrypoint.module', () => {
123
125
  beforeAll(async () => {
124
126
  await resetState(accessToken);
125
127
  res = await (0, entrypoint_module_1.backportRun)({
126
- dir: sandboxPath,
127
- accessToken,
128
- repoOwner: 'backport-org',
129
- repoName: 'integration-test',
130
- sha: [COMMIT_SHA_1, COMMIT_SHA_2],
131
- targetBranches: ['7.x'],
128
+ options: {
129
+ dir: sandboxPath,
130
+ accessToken,
131
+ repoOwner: 'backport-org',
132
+ repoName: 'integration-test',
133
+ sha: [COMMIT_SHA_1, COMMIT_SHA_2],
134
+ targetBranches: ['7.x'],
135
+ },
132
136
  });
133
137
  // @ts-expect-error
134
138
  const pullRequestNumber = res.results[0].pullRequestNumber;
@@ -209,13 +213,15 @@ describe('entrypoint.module', () => {
209
213
  beforeAll(async () => {
210
214
  await resetState(accessToken);
211
215
  res = await (0, entrypoint_module_1.backportRun)({
212
- fork: false,
213
- dir: sandboxPath,
214
- accessToken,
215
- repoOwner: 'backport-org',
216
- repoName: 'integration-test',
217
- sha: COMMIT_SHA_1,
218
- targetBranches: ['7.x'],
216
+ options: {
217
+ fork: false,
218
+ dir: sandboxPath,
219
+ accessToken,
220
+ repoOwner: 'backport-org',
221
+ repoName: 'integration-test',
222
+ sha: COMMIT_SHA_1,
223
+ targetBranches: ['7.x'],
224
+ },
219
225
  });
220
226
  // @ts-expect-error
221
227
  const pullRequestNumber = res.results[0].pullRequestNumber;
@@ -326,6 +332,7 @@ async function deleteBranchOnGithub({ accessToken, repoOwner, repoName, branchNa
326
332
  // console.log(
327
333
  // `Could not delete ${repoOwner}:heads/${branchName} (${e.message})`
328
334
  // );
335
+ //@ts-expect-error
329
336
  if (e.message === 'Reference does not exist') {
330
337
  return;
331
338
  }
@@ -38,14 +38,17 @@ describe('Handle unbackported pull requests', () => {
38
38
  const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
39
39
  await (0, sandbox_1.resetSandbox)(sandboxPath);
40
40
  const result = await (0, entrypoint_module_1.backportRun)({
41
- accessToken: accessToken,
42
- repoOwner: 'backport-org',
43
- repoName: 'repo-with-conflicts',
44
- pullNumber: 12,
45
- targetBranches: ['7.x'],
46
- dir: sandboxPath,
47
- ci: true,
48
- publishStatusComment: false,
41
+ options: {
42
+ accessToken: accessToken,
43
+ repoOwner: 'backport-org',
44
+ repoName: 'repo-with-conflicts',
45
+ pullNumber: 12,
46
+ targetBranches: ['7.x'],
47
+ dir: sandboxPath,
48
+ interactive: false,
49
+ publishStatusCommentOnSuccess: false,
50
+ publishStatusCommentOnFailure: false,
51
+ },
49
52
  });
50
53
  const commit =
51
54
  //@ts-expect-error