backport 6.2.1 → 6.3.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -5
- package/dist/backportRun.d.ts +2 -2
- package/dist/backportRun.js +11 -7
- package/dist/entrypoint.cli.js +0 -0
- package/dist/entrypoint.module.js +1 -1
- package/dist/options/ConfigOptions.d.ts +2 -0
- package/dist/options/cliArgs.js +3 -2
- package/dist/options/config/config.d.ts +2 -0
- package/dist/options/config/config.js +2 -7
- package/dist/options/config/globalConfig.js +3 -3
- package/dist/options/config/readConfigFile.d.ts +2 -0
- package/dist/options/config/readConfigFile.js +2 -2
- package/dist/options/options.d.ts +4 -27
- package/dist/options/options.js +37 -29
- package/dist/runSequentially.d.ts +0 -1
- package/dist/runSequentially.js +0 -1
- package/dist/services/HandledError.d.ts +6 -4
- package/dist/services/HandledError.js +18 -3
- package/dist/services/child-process-promisified.d.ts +3 -1
- package/dist/services/git.d.ts +22 -9
- package/dist/services/git.js +66 -54
- package/dist/services/github/commitFormatters.d.ts +0 -1
- package/dist/services/github/commitFormatters.js +1 -8
- package/dist/services/github/v3/createPullRequest.js +8 -5
- package/dist/services/github/v3/createStatusComment.js +26 -15
- package/dist/services/github/v3/getGithubV3ErrorMessage.d.ts +2 -1
- package/dist/services/github/v4/FetchPullRequestId.d.ts +0 -7
- package/dist/services/github/v4/apiRequestV4.d.ts +21 -17
- package/dist/services/github/v4/apiRequestV4.js +38 -28
- package/dist/services/github/v4/disablePullRequestAutoMerge.d.ts +0 -7
- package/dist/services/github/v4/enablePullRequestAutoMerge.d.ts +0 -7
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +2 -2
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +1 -8
- package/dist/services/github/v4/fetchExistingPullRequest.d.ts +0 -4
- package/dist/services/github/v4/fetchExistingPullRequest.js +1 -2
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +0 -9
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +3 -1
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +38 -32
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +2 -1
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +29 -0
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.js +56 -0
- package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +4 -5
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -7
- package/dist/services/logger.d.ts +6 -3
- package/dist/services/logger.js +11 -7
- package/dist/services/prompts.js +12 -10
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +1 -1
- package/dist/services/sourceCommit/getMockSourceCommit.js +6 -6
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +18 -10
- package/dist/services/sourceCommit/parseSourceCommit.js +20 -14
- package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +0 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +12 -13
- package/dist/ui/getCommits.js +8 -14
- package/dist/ui/getCommitsWithoutBackports.js +6 -6
- package/dist/ui/getTargetBranches.js +1 -1
- package/dist/ui/maybeSetupRepo.js +25 -5
- package/dist/utils/maybe.d.ts +1 -0
- package/dist/utils/maybe.js +7 -0
- package/dist/utils/packageVersion.d.ts +1 -0
- package/dist/{types/PromiseReturnType.js → utils/packageVersion.js} +2 -0
- package/package.json +22 -18
- package/yarn.lock +114 -147
- package/dist/entrypoint.api.d.ts +0 -22
- package/dist/entrypoint.api.js +0 -57
- package/dist/entrypoint.api.private.test.d.ts +0 -1
- package/dist/entrypoint.api.private.test.js +0 -37
- package/dist/entrypoint.module.private.test.d.ts +0 -1
- package/dist/entrypoint.module.private.test.js +0 -37
- package/dist/index.d.ts +0 -783
- package/dist/index.js +0 -8001
- package/dist/ink.d.ts +0 -1
- package/dist/ink.js +0 -49
- package/dist/main.d.ts +0 -14
- package/dist/main.js +0 -68
- package/dist/options/cliArgs.test.d.ts +0 -1
- package/dist/options/cliArgs.test.js +0 -152
- package/dist/options/config/config.test.d.ts +0 -1
- package/dist/options/config/config.test.js +0 -48
- package/dist/options/config/getOptionsFromGit.d.ts +0 -4
- package/dist/options/config/getOptionsFromGit.js +0 -8
- package/dist/options/config/getProjectConfig.d.ts +0 -0
- package/dist/options/config/getProjectConfig.js +0 -1
- package/dist/options/config/globalConfig.test.d.ts +0 -1
- package/dist/options/config/globalConfig.test.js +0 -80
- package/dist/options/config/projectConfig.test.d.ts +0 -1
- package/dist/options/config/projectConfig.test.js +0 -128
- package/dist/options/getValidatedOptions.d.ts +0 -49
- package/dist/options/getValidatedOptions.js +0 -45
- package/dist/options/getValidatedOptions.test.d.ts +0 -1
- package/dist/options/getValidatedOptions.test.js +0 -97
- package/dist/options/options.test.d.ts +0 -1
- package/dist/options/options.test.js +0 -338
- package/dist/options/parseRequiredOptions.d.ts +0 -71
- package/dist/options/parseRequiredOptions.js +0 -68
- package/dist/options/parseRequiredOptions.test.d.ts +0 -1
- package/dist/options/parseRequiredOptions.test.js +0 -122
- package/dist/react-components/0-loadOptions.d.ts +0 -6
- package/dist/react-components/0-loadOptions.js +0 -45
- package/dist/react-components/1-loadCommit.d.ts +0 -8
- package/dist/react-components/1-loadCommit.js +0 -88
- package/dist/react-components/1a-loadCommit.d.ts +0 -5
- package/dist/react-components/1a-loadCommit.js +0 -76
- package/dist/react-components/1b-commitChoices.d.ts +0 -5
- package/dist/react-components/1b-commitChoices.js +0 -98
- package/dist/react-components/2-commitChoices.d.ts +0 -8
- package/dist/react-components/2-commitChoices.js +0 -96
- package/dist/react-components/2-commitsPrompt.d.ts +0 -8
- package/dist/react-components/2-commitsPrompt.js +0 -96
- package/dist/react-components/2-targetBranchChoices.d.ts +0 -9
- package/dist/react-components/2-targetBranchChoices.js +0 -109
- package/dist/react-components/3-cherrypick.d.ts +0 -1
- package/dist/react-components/3-cherrypick.js +0 -2
- package/dist/react-components/App.d.ts +0 -2
- package/dist/react-components/App.js +0 -35
- package/dist/react-components/BackportStateContext.d.ts +0 -33
- package/dist/react-components/BackportStateContext.js +0 -42
- package/dist/react-components/CommitPrompt/2-commitsPrompt.d.ts +0 -8
- package/dist/react-components/CommitPrompt/2-commitsPrompt.js +0 -96
- package/dist/react-components/CommitPrompt/CommitPrompt.d.ts +0 -8
- package/dist/react-components/CommitPrompt/CommitPrompt.js +0 -96
- package/dist/react-components/CommitPrompt/getCommits.d.ts +0 -2
- package/dist/react-components/CommitPrompt/getCommits.js +0 -27
- package/dist/react-components/CommitPrompt.d.ts +0 -8
- package/dist/react-components/CommitPrompt.js +0 -96
- package/dist/react-components/CustomMultiSelect.d.ts +0 -13
- package/dist/react-components/CustomMultiSelect.js +0 -21
- package/dist/react-components/CustomMultiSelectItem.d.ts +0 -5
- package/dist/react-components/CustomMultiSelectItem.js +0 -12
- package/dist/react-components/CustomSelect.d.ts +0 -14
- package/dist/react-components/CustomSelect.js +0 -34
- package/dist/react-components/ErrorBoundary.d.ts +0 -15
- package/dist/react-components/ErrorBoundary.js +0 -53
- package/dist/react-components/MultiSelect.d.ts +0 -7
- package/dist/react-components/MultiSelect.js +0 -16
- package/dist/react-components/hooks/useAsync.d.ts +0 -12
- package/dist/react-components/hooks/useAsync.js +0 -73
- package/dist/runSequentially.test.d.ts +0 -1
- package/dist/runSequentially.test.js +0 -195
- package/dist/runWithOptions.d.ts +0 -9
- package/dist/runWithOptions.js +0 -43
- package/dist/runWithOptions.test.d.ts +0 -1
- package/dist/runWithOptions.test.js +0 -304
- package/dist/scripts/generate-gql.d.ts +0 -1
- package/dist/scripts/generate-gql.js +0 -15
- package/dist/scripts/postinstall.test.d.ts +0 -1
- package/dist/scripts/postinstall.test.js +0 -53
- package/dist/services/backportRun/backportRun.ci.d.ts +0 -6
- package/dist/services/backportRun/backportRun.ci.js +0 -81
- package/dist/services/backportRun/backportRun.d.ts +0 -14
- package/dist/services/backportRun/backportRun.interactive.d.ts +0 -1
- package/dist/services/backportRun/backportRun.interactive.js +0 -4
- package/dist/services/backportRun/backportRun.js +0 -14
- package/dist/services/backportRun/backportState.d.ts +0 -4
- package/dist/services/backportRun/backportState.js +0 -28
- package/dist/services/backportRun/getCommits.d.ts +0 -2
- package/dist/services/backportRun/getCommits.js +0 -20
- package/dist/services/backportRun/runSequentially.d.ts +0 -20
- package/dist/services/backportRun/runSequentially.js +0 -41
- package/dist/services/backportRun/runSequentially.test.d.ts +0 -1
- package/dist/services/backportRun/runSequentially.test.js +0 -199
- package/dist/services/cherrypickAndCreateTargetPullRequest.d.ts +0 -12
- package/dist/services/cherrypickAndCreateTargetPullRequest.js +0 -206
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.js +0 -403
- package/dist/services/env.test.d.ts +0 -1
- package/dist/services/env.test.js +0 -21
- package/dist/services/fs-promisified.d.ts +0 -6
- package/dist/services/fs-promisified.js +0 -12
- package/dist/services/getCommits.d.ts +0 -2
- package/dist/services/getCommits.js +0 -38
- package/dist/services/getCommitsWithoutBackports.d.ts +0 -11
- package/dist/services/getCommitsWithoutBackports.js +0 -68
- package/dist/services/getCommitsWithoutBackports.test.d.ts +0 -1
- package/dist/services/getCommitsWithoutBackports.test.js +0 -259
- package/dist/services/getExpectedTarget.d.ts +0 -9
- package/dist/services/getExpectedTarget.js +0 -77
- package/dist/services/getExpectedTargetPullRequests.d.ts +0 -9
- package/dist/services/getExpectedTargetPullRequests.js +0 -77
- package/dist/services/getTargetBranches.d.ts +0 -5
- package/dist/services/getTargetBranches.js +0 -60
- package/dist/services/getTargetBranches.test.d.ts +0 -1
- package/dist/services/getTargetBranches.test.js +0 -180
- package/dist/services/git.integration.test.d.ts +0 -1
- package/dist/services/git.integration.test.js +0 -168
- package/dist/services/git.test.d.ts +0 -1
- package/dist/services/git.test.js +0 -503
- package/dist/services/github/commitFormatters.test.d.ts +0 -1
- package/dist/services/github/commitFormatters.test.js +0 -11
- package/dist/services/github/v3/addAssigneesToPullRequest.test.d.ts +0 -1
- package/dist/services/github/v3/addAssigneesToPullRequest.test.js +0 -27
- package/dist/services/github/v3/createPullRequest.test.d.ts +0 -1
- package/dist/services/github/v3/createPullRequest.test.js +0 -160
- package/dist/services/github/v3/createStatusComment.test.d.ts +0 -1
- package/dist/services/github/v3/createStatusComment.test.js +0 -326
- package/dist/services/github/v4/apiRequestV4.test.d.ts +0 -1
- package/dist/services/github/v4/apiRequestV4.test.js +0 -82
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.d.ts +0 -1
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +0 -112
- package/dist/services/github/v4/fetchAuthorId.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchAuthorId.private.test.js +0 -28
- package/dist/services/github/v4/fetchCommitByPullNumber.d.ts +0 -5
- package/dist/services/github/v4/fetchCommitByPullNumber.js +0 -86
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +0 -57
- package/dist/services/github/v4/fetchCommitBySha.d.ts +0 -5
- package/dist/services/github/v4/fetchCommitBySha.js +0 -95
- package/dist/services/github/v4/fetchCommitBySha.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitBySha.private.test.js +0 -50
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +0 -78
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +0 -134
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +0 -115
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +0 -200
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +0 -131
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +0 -28
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +0 -52
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.d.ts +0 -3
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.js +0 -55
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +0 -85
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +0 -252
- package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +0 -28
- package/dist/services/github/v4/fetchCommitsByAuthor.js +0 -161
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +0 -115
- package/dist/services/github/v4/fetchCommitsByAuthor.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitsByAuthor.test.js +0 -272
- package/dist/services/github/v4/fetchDefaultBranch.d.ts +0 -9
- package/dist/services/github/v4/fetchDefaultBranch.js +0 -24
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -4
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -52
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.d.ts +0 -4
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.js +0 -72
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.js +0 -34
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.d.ts +0 -40
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.js +0 -72
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -17
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -69
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +0 -47
- package/dist/services/github/v4/fetchMergedPullRequests.d.ts +0 -37
- package/dist/services/github/v4/fetchMergedPullRequests.js +0 -37
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +0 -59
- package/dist/services/github/v4/fetchMergedPullRequests.test.d.ts +0 -1
- package/dist/services/github/v4/fetchMergedPullRequests.test.js +0 -22
- package/dist/services/github/v4/fetchProjectConfig.d.ts +0 -8
- package/dist/services/github/v4/fetchProjectConfig.js +0 -56
- package/dist/services/github/v4/fetchProjectConfig.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchProjectConfig.private.test.js +0 -52
- package/dist/services/github/v4/fetchProjectConfig.test.d.ts +0 -1
- package/dist/services/github/v4/fetchProjectConfig.test.js +0 -37
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.d.ts +0 -9
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +0 -92
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +0 -66
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.d.ts +0 -1
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +0 -242
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +0 -52
- package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +0 -7
- package/dist/services/github/v4/getExistingTargetPullRequests.js +0 -45
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +0 -1
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +0 -130
- package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +0 -63
- package/dist/services/github/v4/getOptionsFromGithub/index.js +0 -139
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.d.ts +0 -1
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +0 -147
- package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -5
- package/dist/services/github/v4/getTargetBranchesFromLabels.js +0 -20
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +0 -201
- package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +0 -154
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +0 -843
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +0 -73
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +0 -12
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +0 -44
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.d.ts +0 -1
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +0 -87
- package/dist/services/maybeSetupRepo.d.ts +0 -2
- package/dist/services/maybeSetupRepo.js +0 -33
- package/dist/services/maybeSetupRepo.test.d.ts +0 -1
- package/dist/services/maybeSetupRepo.test.js +0 -78
- package/dist/services/prompt.test.d.ts +0 -1
- package/dist/services/prompt.test.js +0 -87
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +0 -1
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +0 -433
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +0 -5
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +0 -20
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +0 -201
- package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit/parseSourceCommit.test.js +0 -237
- package/dist/services/sourceCommit/sourceCommit.d.ts +0 -78
- package/dist/services/sourceCommit/sourceCommit.js +0 -86
- package/dist/services/sourceCommit/sourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit/sourceCommit.test.js +0 -287
- package/dist/services/sourceCommit.d.ts +0 -78
- package/dist/services/sourceCommit.js +0 -86
- package/dist/services/sourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit.test.js +0 -280
- package/dist/test/ExecError.d.ts +0 -16
- package/dist/test/ExecError.js +0 -15
- package/dist/test/backport-e2e.private.test.d.ts +0 -1
- package/dist/test/backport-e2e.private.test.js +0 -325
- package/dist/test/handleUnbackportedPullRequests.private.test.d.ts +0 -1
- package/dist/test/handleUnbackportedPullRequests.private.test.js +0 -43
- package/dist/test/inquirer.private.test.d.ts +0 -1
- package/dist/test/inquirer.private.test.js +0 -170
- package/dist/test/integration/createSpies.d.ts +0 -17
- package/dist/test/integration/createSpies.js +0 -85
- package/dist/test/integration/envConstants.d.ts +0 -5
- package/dist/test/integration/envConstants.js +0 -9
- package/dist/test/integration/helpers.d.ts +0 -7
- package/dist/test/integration/helpers.js +0 -31
- package/dist/test/integration/integration.private.test.d.ts +0 -1
- package/dist/test/integration/integration.private.test.js +0 -327
- package/dist/test/integration/integration.test.d.ts +0 -1
- package/dist/test/integration/integration.test.js +0 -214
- package/dist/test/mockConfigFiles.d.ts +0 -5
- package/dist/test/mockConfigFiles.js +0 -37
- package/dist/test/nockHelpers.d.ts +0 -16
- package/dist/test/nockHelpers.js +0 -32
- package/dist/test/private/getDevAccessToken.d.ts +0 -1
- package/dist/test/private/getDevAccessToken.js +0 -24
- package/dist/test/setupFiles/automatic-mocks.d.ts +0 -0
- package/dist/test/setupFiles/automatic-mocks.js +0 -43
- package/dist/todo-delete.d.ts +0 -1
- package/dist/todo-delete.js +0 -17
- package/dist/types/Commit.d.ts +0 -85
- package/dist/types/Commit.js +0 -139
- package/dist/types/PromiseReturnType.d.ts +0 -1
- package/dist/types/commitNode.d.ts +0 -89
- package/dist/types/commitNode.js +0 -139
- package/dist/types/commitNode.test.d.ts +0 -1
- package/dist/types/commitNode.test.js +0 -255
- package/dist/types/commitWithAssociatedPullRequests.d.ts +0 -86
- package/dist/types/commitWithAssociatedPullRequests.js +0 -145
- package/dist/ui/cherrypickAndCreatePullRequest.test.d.ts +0 -1
- package/dist/ui/cherrypickAndCreatePullRequest.test.js +0 -617
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +0 -427
- package/dist/ui/getCommitsWithoutBackports.test.d.ts +0 -1
- package/dist/ui/getCommitsWithoutBackports.test.js +0 -259
- package/dist/ui/getTargetBranches.test.d.ts +0 -1
- package/dist/ui/getTargetBranches.test.js +0 -180
- package/dist/ui/getTargetBranchesFromLabels.d.ts +0 -6
- package/dist/ui/getTargetBranchesFromLabels.js +0 -40
- package/dist/ui/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/ui/getTargetBranchesFromLabels.test.js +0 -288
- package/dist/ui/maybeSetupRepo.test.d.ts +0 -1
- package/dist/ui/maybeSetupRepo.test.js +0 -78
- package/dist/utils/excludeUndefined.test.d.ts +0 -1
- package/dist/utils/excludeUndefined.test.js +0 -24
- package/dist/utils/sequentially.d.ts +0 -1
- package/dist/utils/sequentially.js +0 -10
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const createPullRequest_1 = require("./createPullRequest");
|
|
4
|
-
describe('getPullRequestBody', () => {
|
|
5
|
-
it('when single pull request is backported', () => {
|
|
6
|
-
expect((0, createPullRequest_1.getPullRequestBody)({
|
|
7
|
-
options: {},
|
|
8
|
-
commits: [
|
|
9
|
-
{
|
|
10
|
-
pullNumber: 55,
|
|
11
|
-
sha: 'abcdefghi',
|
|
12
|
-
originalMessage: 'My commit message',
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
targetBranch: '7.x',
|
|
16
|
-
})).toMatchInlineSnapshot(`
|
|
17
|
-
"# Backport
|
|
18
|
-
|
|
19
|
-
This is an automatic backport to \`7.x\` of:
|
|
20
|
-
- #55
|
|
21
|
-
|
|
22
|
-
### Questions ?
|
|
23
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
24
|
-
`);
|
|
25
|
-
});
|
|
26
|
-
it('when a single commit (non pull request) is backported', () => {
|
|
27
|
-
expect((0, createPullRequest_1.getPullRequestBody)({
|
|
28
|
-
options: {},
|
|
29
|
-
commits: [
|
|
30
|
-
{
|
|
31
|
-
sha: 'abcdefghijklmw',
|
|
32
|
-
originalMessage: 'My commit message',
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
targetBranch: '7.x',
|
|
36
|
-
})).toMatchInlineSnapshot(`
|
|
37
|
-
"# Backport
|
|
38
|
-
|
|
39
|
-
This is an automatic backport to \`7.x\` of:
|
|
40
|
-
- My commit message (abcdefgh)
|
|
41
|
-
|
|
42
|
-
### Questions ?
|
|
43
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
44
|
-
`);
|
|
45
|
-
});
|
|
46
|
-
it('when multiple commits are backported', () => {
|
|
47
|
-
expect((0, createPullRequest_1.getPullRequestBody)({
|
|
48
|
-
options: {},
|
|
49
|
-
commits: [
|
|
50
|
-
{
|
|
51
|
-
pullNumber: 55,
|
|
52
|
-
sha: 'abcdefghijklm',
|
|
53
|
-
originalMessage: 'My commit message',
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
sha: 'qwertyuiop',
|
|
57
|
-
originalMessage: 'Another commit message',
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
targetBranch: '7.x',
|
|
61
|
-
})).toMatchInlineSnapshot(`
|
|
62
|
-
"# Backport
|
|
63
|
-
|
|
64
|
-
This is an automatic backport to \`7.x\` of:
|
|
65
|
-
- #55
|
|
66
|
-
- Another commit message (qwertyui)
|
|
67
|
-
|
|
68
|
-
### Questions ?
|
|
69
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
70
|
-
`);
|
|
71
|
-
});
|
|
72
|
-
it('replaces template variables in PR description', () => {
|
|
73
|
-
expect((0, createPullRequest_1.getPullRequestBody)({
|
|
74
|
-
options: {
|
|
75
|
-
prDescription: 'Backporting the following to {targetBranch}:\n{commitMessages}',
|
|
76
|
-
},
|
|
77
|
-
commits: [
|
|
78
|
-
{
|
|
79
|
-
pullNumber: 55,
|
|
80
|
-
sha: 'abcdefghijklm',
|
|
81
|
-
originalMessage: 'My commit message',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
sha: 'qwertyuiop',
|
|
85
|
-
originalMessage: 'Another commit message',
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
targetBranch: '7.x',
|
|
89
|
-
})).toMatchInlineSnapshot(`
|
|
90
|
-
"Backporting the following to 7.x:
|
|
91
|
-
- #55
|
|
92
|
-
- Another commit message (qwertyui)"
|
|
93
|
-
`);
|
|
94
|
-
});
|
|
95
|
-
it('appends text to the default descriptions', () => {
|
|
96
|
-
expect((0, createPullRequest_1.getPullRequestBody)({
|
|
97
|
-
options: {
|
|
98
|
-
prDescription: '{defaultPrDescription}\n\ntext to append',
|
|
99
|
-
},
|
|
100
|
-
commits: [
|
|
101
|
-
{
|
|
102
|
-
pullNumber: 55,
|
|
103
|
-
sha: 'abcdefghijklm',
|
|
104
|
-
originalMessage: 'My commit message',
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
sha: 'qwertyuiop',
|
|
108
|
-
originalMessage: 'Another commit message',
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
targetBranch: '7.x',
|
|
112
|
-
})).toMatchInlineSnapshot(`
|
|
113
|
-
"# Backport
|
|
114
|
-
|
|
115
|
-
This is an automatic backport to \`7.x\` of:
|
|
116
|
-
- #55
|
|
117
|
-
- Another commit message (qwertyui)
|
|
118
|
-
|
|
119
|
-
### Questions ?
|
|
120
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
121
|
-
|
|
122
|
-
text to append"
|
|
123
|
-
`);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
describe('getTitle', () => {
|
|
127
|
-
it('has the default title', () => {
|
|
128
|
-
expect((0, createPullRequest_1.getTitle)({
|
|
129
|
-
options: {},
|
|
130
|
-
commits: [
|
|
131
|
-
{
|
|
132
|
-
pullNumber: 55,
|
|
133
|
-
sha: 'abcdefghi',
|
|
134
|
-
originalMessage: 'My commit message',
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
pullNumber: 56,
|
|
138
|
-
sha: 'jklmnopqr',
|
|
139
|
-
originalMessage: 'Another commit message',
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
targetBranch: '7.x',
|
|
143
|
-
})).toEqual('[7.x] My commit message | Another commit message');
|
|
144
|
-
});
|
|
145
|
-
it('replaces template variables in PR title', () => {
|
|
146
|
-
expect((0, createPullRequest_1.getTitle)({
|
|
147
|
-
options: {
|
|
148
|
-
prTitle: 'Branch: "{targetBranch}". Messages: {commitMessages}',
|
|
149
|
-
},
|
|
150
|
-
commits: [
|
|
151
|
-
{
|
|
152
|
-
pullNumber: 55,
|
|
153
|
-
sha: 'abcdefghi',
|
|
154
|
-
originalMessage: 'My commit message',
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
targetBranch: '7.x',
|
|
158
|
-
})).toEqual('Branch: "7.x". Messages: My commit message');
|
|
159
|
-
});
|
|
160
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const nock_1 = __importDefault(require("nock"));
|
|
7
|
-
const HandledError_1 = require("../../HandledError");
|
|
8
|
-
const createStatusComment_1 = require("./createStatusComment");
|
|
9
|
-
describe('createStatusComment', () => {
|
|
10
|
-
it('redacts accessToken if it is included in the error message', async () => {
|
|
11
|
-
const accessToken = 'ghp_abcdefg';
|
|
12
|
-
const scope = (0, nock_1.default)('https://api.github.com')
|
|
13
|
-
.post('/repos/elastic/kibana/issues/100/comments')
|
|
14
|
-
.reply(200, 'some response');
|
|
15
|
-
let postedCommentBody = '';
|
|
16
|
-
scope.on('request', (req, interceptor, body) => {
|
|
17
|
-
postedCommentBody = JSON.parse(body).body;
|
|
18
|
-
});
|
|
19
|
-
await (0, createStatusComment_1.createStatusComment)({
|
|
20
|
-
options: {
|
|
21
|
-
repoName: 'kibana',
|
|
22
|
-
repoOwner: 'elastic',
|
|
23
|
-
accessToken,
|
|
24
|
-
backportBinary: 'node scripts/backport',
|
|
25
|
-
publishStatusComment: true,
|
|
26
|
-
githubApiBaseUrlV3: 'https://api.github.com',
|
|
27
|
-
ci: true,
|
|
28
|
-
},
|
|
29
|
-
backportResponse: {
|
|
30
|
-
commits: [{ pullNumber: 100 }],
|
|
31
|
-
status: 'failure',
|
|
32
|
-
errorMessage: `Error message containing very secret access token: ${accessToken}.`,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
expect(postedCommentBody).toContain('Error message containing very secret access token: <REDACTED>');
|
|
36
|
-
scope.done();
|
|
37
|
-
nock_1.default.cleanAll();
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
describe('getCommentBody', () => {
|
|
41
|
-
describe('when an unknown error occurs', () => {
|
|
42
|
-
const getParams = (opts) => ({
|
|
43
|
-
options: {
|
|
44
|
-
backportBinary: 'node scripts/backport',
|
|
45
|
-
...opts,
|
|
46
|
-
},
|
|
47
|
-
pullNumber: 55,
|
|
48
|
-
backportResponse: {
|
|
49
|
-
status: 'failure',
|
|
50
|
-
errorMessage: 'A terrible error occured',
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
it('posts a comment when running on ci', () => {
|
|
54
|
-
const params = getParams({ ci: true });
|
|
55
|
-
expect((0, createStatusComment_1.getCommentBody)(params)).toMatchInlineSnapshot(`
|
|
56
|
-
"## 💔 Backport failed
|
|
57
|
-
The pull request could not be backported due to the following error:
|
|
58
|
-
\`A terrible error occured\`
|
|
59
|
-
|
|
60
|
-
### How to fix
|
|
61
|
-
Re-run the backport manually:
|
|
62
|
-
\`\`\`
|
|
63
|
-
node scripts/backport --pr 55
|
|
64
|
-
\`\`\`
|
|
65
|
-
|
|
66
|
-
### Questions ?
|
|
67
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
68
|
-
`);
|
|
69
|
-
});
|
|
70
|
-
it('does not post a comment when running manually', () => {
|
|
71
|
-
const params = getParams({ ci: false });
|
|
72
|
-
expect((0, createStatusComment_1.getCommentBody)(params)).toBe(undefined);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
describe('when all backports succeed', () => {
|
|
76
|
-
const getParams = (opts) => ({
|
|
77
|
-
options: {
|
|
78
|
-
repoName: 'kibana',
|
|
79
|
-
repoOwner: 'elastic',
|
|
80
|
-
autoMerge: true,
|
|
81
|
-
...opts,
|
|
82
|
-
},
|
|
83
|
-
pullNumber: 55,
|
|
84
|
-
backportResponse: {
|
|
85
|
-
status: 'success',
|
|
86
|
-
results: [
|
|
87
|
-
{
|
|
88
|
-
status: 'success',
|
|
89
|
-
targetBranch: '7.x',
|
|
90
|
-
pullRequestNumber: 55,
|
|
91
|
-
pullRequestUrl: 'url-to-pr',
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
status: 'success',
|
|
95
|
-
targetBranch: '7.1',
|
|
96
|
-
pullRequestNumber: 66,
|
|
97
|
-
pullRequestUrl: 'url-to-pr',
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
it('posts a comment on ci', () => {
|
|
103
|
-
const params = getParams({ ci: true });
|
|
104
|
-
expect((0, createStatusComment_1.getCommentBody)(params)).toMatchInlineSnapshot(`
|
|
105
|
-
"## 💚 All backports created successfully
|
|
106
|
-
|
|
107
|
-
| Status | Branch | Result |
|
|
108
|
-
|:------:|:------:|:------|
|
|
109
|
-
|✅|7.x|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/55\\">](url-to-pr)|
|
|
110
|
-
|✅|7.1|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/66\\">](url-to-pr)|
|
|
111
|
-
|
|
112
|
-
Note: Successful backport PRs will be merged automatically after passing CI.
|
|
113
|
-
|
|
114
|
-
### Questions ?
|
|
115
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
116
|
-
`);
|
|
117
|
-
});
|
|
118
|
-
it('posts a comment when running locally', () => {
|
|
119
|
-
const params = getParams({ ci: false });
|
|
120
|
-
expect((0, createStatusComment_1.getCommentBody)(params)).toMatchInlineSnapshot(`
|
|
121
|
-
"## 💚 All backports created successfully
|
|
122
|
-
|
|
123
|
-
| Status | Branch | Result |
|
|
124
|
-
|:------:|:------:|:------|
|
|
125
|
-
|✅|7.x|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/55\\">](url-to-pr)|
|
|
126
|
-
|✅|7.1|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/66\\">](url-to-pr)|
|
|
127
|
-
|
|
128
|
-
Note: Successful backport PRs will be merged automatically after passing CI.
|
|
129
|
-
|
|
130
|
-
### Questions ?
|
|
131
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
132
|
-
`);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
describe('when all backports fail', () => {
|
|
136
|
-
const getParams = (opts) => ({
|
|
137
|
-
options: {
|
|
138
|
-
repoName: 'kibana',
|
|
139
|
-
repoOwner: 'elastic',
|
|
140
|
-
autoMerge: true,
|
|
141
|
-
backportBinary: 'node scripts/backport',
|
|
142
|
-
...opts,
|
|
143
|
-
},
|
|
144
|
-
pullNumber: 55,
|
|
145
|
-
backportResponse: {
|
|
146
|
-
status: 'success',
|
|
147
|
-
results: [
|
|
148
|
-
{
|
|
149
|
-
status: 'failure',
|
|
150
|
-
targetBranch: '7.x',
|
|
151
|
-
error: new Error('Boom!'),
|
|
152
|
-
errorMessage: 'My boom error!',
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
status: 'failure',
|
|
156
|
-
targetBranch: '7.1',
|
|
157
|
-
error: new Error('Boom!'),
|
|
158
|
-
errorMessage: 'My boom error!',
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
},
|
|
162
|
-
});
|
|
163
|
-
it('posts a comment on CI', () => {
|
|
164
|
-
const params = getParams({ ci: true });
|
|
165
|
-
expect((0, createStatusComment_1.getCommentBody)(params)).toMatchInlineSnapshot(`
|
|
166
|
-
"## 💔 All backports failed
|
|
167
|
-
|
|
168
|
-
| Status | Branch | Result |
|
|
169
|
-
|:------:|:------:|:------|
|
|
170
|
-
|❌|7.x|My boom error!|
|
|
171
|
-
|❌|7.1|My boom error!|
|
|
172
|
-
|
|
173
|
-
### How to fix
|
|
174
|
-
Re-run the backport manually:
|
|
175
|
-
\`\`\`
|
|
176
|
-
node scripts/backport --pr 55
|
|
177
|
-
\`\`\`
|
|
178
|
-
|
|
179
|
-
### Questions ?
|
|
180
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
181
|
-
`);
|
|
182
|
-
});
|
|
183
|
-
it('does not post a comment when running manaully', () => {
|
|
184
|
-
const params = getParams({ ci: false });
|
|
185
|
-
expect((0, createStatusComment_1.getCommentBody)(params)).toBe(undefined);
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
describe('when some backports fail', () => {
|
|
189
|
-
const getParams = (opts) => ({
|
|
190
|
-
options: {
|
|
191
|
-
repoName: 'kibana',
|
|
192
|
-
repoOwner: 'elastic',
|
|
193
|
-
autoMerge: true,
|
|
194
|
-
backportBinary: 'node scripts/backport',
|
|
195
|
-
...opts,
|
|
196
|
-
},
|
|
197
|
-
pullNumber: 55,
|
|
198
|
-
backportResponse: {
|
|
199
|
-
status: 'success',
|
|
200
|
-
results: [
|
|
201
|
-
{
|
|
202
|
-
status: 'success',
|
|
203
|
-
targetBranch: '7.x',
|
|
204
|
-
pullRequestNumber: 55,
|
|
205
|
-
pullRequestUrl: 'url-to-pr-55',
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
status: 'failure',
|
|
209
|
-
targetBranch: '7.1',
|
|
210
|
-
error: new Error('Boom!'),
|
|
211
|
-
errorMessage: 'My boom error!',
|
|
212
|
-
},
|
|
213
|
-
],
|
|
214
|
-
},
|
|
215
|
-
});
|
|
216
|
-
it('post a comment when running on CI', () => {
|
|
217
|
-
const params = getParams({ ci: true });
|
|
218
|
-
expect((0, createStatusComment_1.getCommentBody)(params)).toMatchInlineSnapshot(`
|
|
219
|
-
"## 💔 Some backports could not be created
|
|
220
|
-
|
|
221
|
-
| Status | Branch | Result |
|
|
222
|
-
|:------:|:------:|:------|
|
|
223
|
-
|✅|7.x|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/55\\">](url-to-pr-55)|
|
|
224
|
-
|❌|7.1|My boom error!|
|
|
225
|
-
|
|
226
|
-
### How to fix
|
|
227
|
-
Re-run the backport manually:
|
|
228
|
-
\`\`\`
|
|
229
|
-
node scripts/backport --pr 55
|
|
230
|
-
\`\`\`
|
|
231
|
-
Note: Successful backport PRs will be merged automatically after passing CI.
|
|
232
|
-
|
|
233
|
-
### Questions ?
|
|
234
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
235
|
-
`);
|
|
236
|
-
});
|
|
237
|
-
it('does not post a comment when running manually because some backports failed', () => {
|
|
238
|
-
const params = getParams({ ci: false });
|
|
239
|
-
expect((0, createStatusComment_1.getCommentBody)(params)).toMatchInlineSnapshot(`undefined`);
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
describe('when some backports fail due to conflicts', () => {
|
|
243
|
-
const getParams = (opts) => ({
|
|
244
|
-
options: {
|
|
245
|
-
repoName: 'kibana',
|
|
246
|
-
repoOwner: 'elastic',
|
|
247
|
-
autoMerge: true,
|
|
248
|
-
backportBinary: 'node scripts/backport',
|
|
249
|
-
...opts,
|
|
250
|
-
},
|
|
251
|
-
pullNumber: 55,
|
|
252
|
-
backportResponse: {
|
|
253
|
-
status: 'success',
|
|
254
|
-
results: [
|
|
255
|
-
{
|
|
256
|
-
status: 'success',
|
|
257
|
-
targetBranch: '7.x',
|
|
258
|
-
pullRequestNumber: 55,
|
|
259
|
-
pullRequestUrl: 'url-to-pr-55',
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
status: 'failure',
|
|
263
|
-
targetBranch: '7.1',
|
|
264
|
-
errorMessage: 'My boom error!',
|
|
265
|
-
error: new HandledError_1.HandledError('Boom!', {
|
|
266
|
-
type: 'merge-conflict-due-to-missing-backports',
|
|
267
|
-
commitsWithoutBackports: [
|
|
268
|
-
{
|
|
269
|
-
//@ts-expect-error
|
|
270
|
-
commit: {
|
|
271
|
-
pullNumber: 5,
|
|
272
|
-
pullUrl: 'url-to-pr-5',
|
|
273
|
-
originalMessage: 'New Zealand commit message',
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
//@ts-expect-error
|
|
278
|
-
commit: {
|
|
279
|
-
pullNumber: 44,
|
|
280
|
-
pullUrl: 'url-to-pr-44',
|
|
281
|
-
originalMessage: 'Australia commit',
|
|
282
|
-
},
|
|
283
|
-
},
|
|
284
|
-
],
|
|
285
|
-
}),
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
status: 'failure',
|
|
289
|
-
targetBranch: '7.2',
|
|
290
|
-
errorMessage: 'My boom error!',
|
|
291
|
-
error: new HandledError_1.HandledError('Boom!', {
|
|
292
|
-
type: 'merge-conflict-due-to-missing-backports',
|
|
293
|
-
commitsWithoutBackports: [],
|
|
294
|
-
}),
|
|
295
|
-
},
|
|
296
|
-
],
|
|
297
|
-
},
|
|
298
|
-
});
|
|
299
|
-
it('posts a comment when running on CI', () => {
|
|
300
|
-
const params = getParams({ ci: true });
|
|
301
|
-
expect((0, createStatusComment_1.getCommentBody)(params)).toMatchInlineSnapshot(`
|
|
302
|
-
"## 💔 Some backports could not be created
|
|
303
|
-
|
|
304
|
-
| Status | Branch | Result |
|
|
305
|
-
|:------:|:------:|:------|
|
|
306
|
-
|✅|7.x|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/55\\">](url-to-pr-55)|
|
|
307
|
-
|❌|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)|
|
|
308
|
-
|❌|7.2|**Backport failed because of merge conflicts**|
|
|
309
|
-
|
|
310
|
-
### How to fix
|
|
311
|
-
Re-run the backport manually:
|
|
312
|
-
\`\`\`
|
|
313
|
-
node scripts/backport --pr 55
|
|
314
|
-
\`\`\`
|
|
315
|
-
Note: Successful backport PRs will be merged automatically after passing CI.
|
|
316
|
-
|
|
317
|
-
### Questions ?
|
|
318
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
319
|
-
`);
|
|
320
|
-
});
|
|
321
|
-
it('does not post a comment when running manually because some backports failed', () => {
|
|
322
|
-
const params = getParams({ ci: false });
|
|
323
|
-
expect((0, createStatusComment_1.getCommentBody)(params)).toMatchInlineSnapshot(`undefined`);
|
|
324
|
-
});
|
|
325
|
-
});
|
|
326
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const nock_1 = __importDefault(require("nock"));
|
|
7
|
-
const nockHelpers_1 = require("../../../test/nockHelpers");
|
|
8
|
-
const HandledError_1 = require("../../HandledError");
|
|
9
|
-
const apiRequestV4_1 = require("./apiRequestV4");
|
|
10
|
-
describe('apiRequestV4', () => {
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
nock_1.default.cleanAll();
|
|
13
|
-
});
|
|
14
|
-
describe('when request succeeds', () => {
|
|
15
|
-
let res;
|
|
16
|
-
let commitsByAuthorCalls;
|
|
17
|
-
beforeEach(async () => {
|
|
18
|
-
commitsByAuthorCalls = (0, nockHelpers_1.mockGqlRequest)({
|
|
19
|
-
name: 'MyQuery',
|
|
20
|
-
statusCode: 200,
|
|
21
|
-
body: { data: { hello: 'world' } },
|
|
22
|
-
});
|
|
23
|
-
res = await (0, apiRequestV4_1.apiRequestV4)({
|
|
24
|
-
accessToken: 'myAccessToken',
|
|
25
|
-
githubApiBaseUrlV4: 'http://localhost/graphql',
|
|
26
|
-
query: 'query MyQuery{ foo }',
|
|
27
|
-
variables: { foo: 'bar' },
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
it('should return correct response', async () => {
|
|
31
|
-
expect(res).toEqual({ hello: 'world' });
|
|
32
|
-
});
|
|
33
|
-
it('should call with correct args', async () => {
|
|
34
|
-
expect(commitsByAuthorCalls).toEqual([
|
|
35
|
-
{
|
|
36
|
-
query: 'query MyQuery{ foo }',
|
|
37
|
-
variables: { foo: 'bar' },
|
|
38
|
-
},
|
|
39
|
-
]);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
describe('when request fails with error messages', () => {
|
|
43
|
-
beforeEach(() => {
|
|
44
|
-
(0, nockHelpers_1.mockGqlRequest)({
|
|
45
|
-
name: 'MyQuery',
|
|
46
|
-
statusCode: 500,
|
|
47
|
-
body: {
|
|
48
|
-
errors: [{ message: 'some error' }, { message: 'some other error' }],
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
it('should return parsed github error', async () => {
|
|
53
|
-
return expect((0, apiRequestV4_1.apiRequestV4)({
|
|
54
|
-
accessToken: 'myAccessToken',
|
|
55
|
-
githubApiBaseUrlV4: 'http://localhost/graphql',
|
|
56
|
-
query: 'query MyQuery{ foo }',
|
|
57
|
-
variables: {
|
|
58
|
-
foo: 'bar',
|
|
59
|
-
},
|
|
60
|
-
})).rejects.toThrowError(new HandledError_1.HandledError(`some error, some other error (Unhandled Github v4 error)`));
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
describe('when request fails without error messages', () => {
|
|
64
|
-
beforeEach(() => {
|
|
65
|
-
(0, nockHelpers_1.mockGqlRequest)({
|
|
66
|
-
name: 'MyQuery',
|
|
67
|
-
statusCode: 500,
|
|
68
|
-
body: { data: { foo: 'bar' } },
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
it('should return parsed github error', async () => {
|
|
72
|
-
return expect((0, apiRequestV4_1.apiRequestV4)({
|
|
73
|
-
accessToken: 'myAccessToken',
|
|
74
|
-
githubApiBaseUrlV4: 'http://localhost/graphql',
|
|
75
|
-
query: 'query MyQuery{ foo }',
|
|
76
|
-
variables: {
|
|
77
|
-
foo: 'bar',
|
|
78
|
-
},
|
|
79
|
-
})).rejects.toThrowErrorMatchingSnapshot();
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
7
|
-
const rest_1 = require("@octokit/rest");
|
|
8
|
-
const getDevAccessToken_1 = require("../../../test/private/getDevAccessToken");
|
|
9
|
-
const createPullRequest_1 = require("../v3/createPullRequest");
|
|
10
|
-
const disablePullRequestAutoMerge_1 = require("./disablePullRequestAutoMerge");
|
|
11
|
-
const enablePullRequestAutoMerge_1 = require("./enablePullRequestAutoMerge");
|
|
12
|
-
const fetchPullRequestAutoMergeMethod_1 = require("./fetchPullRequestAutoMergeMethod");
|
|
13
|
-
// The test repo requires auto-merge being enabled in options, as well as all merge types enabled (merge, squash, rebase)
|
|
14
|
-
// The test pull requests should be open, and not currently able to be merged (e.g. because it requires an approval),
|
|
15
|
-
// otherwise it will be merged when auto-merge is turned on
|
|
16
|
-
const TEST_REPO_OWNER = 'backport-org';
|
|
17
|
-
const TEST_REPO_NAME = 'repo-with-auto-merge-enabled';
|
|
18
|
-
// commit to create new branch from
|
|
19
|
-
// https://github.com/backport-org/repo-with-auto-merge-enabled/commit/1a88d210f90a22e2a06253c5760909833dc820e9
|
|
20
|
-
const COMMIT_SHA = '1a88d210f90a22e2a06253c5760909833dc820e9';
|
|
21
|
-
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
22
|
-
async function closePr(octokit, pullNumber) {
|
|
23
|
-
await octokit.pulls.update({
|
|
24
|
-
owner: TEST_REPO_OWNER,
|
|
25
|
-
repo: TEST_REPO_NAME,
|
|
26
|
-
pull_number: pullNumber,
|
|
27
|
-
state: 'closed',
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
async function createPr(options, branchName) {
|
|
31
|
-
const prPayload = {
|
|
32
|
-
base: 'main',
|
|
33
|
-
head: branchName,
|
|
34
|
-
body: 'testing...',
|
|
35
|
-
owner: TEST_REPO_OWNER,
|
|
36
|
-
repo: TEST_REPO_NAME,
|
|
37
|
-
title: 'my pr title',
|
|
38
|
-
};
|
|
39
|
-
const { number } = await (0, createPullRequest_1.createPullRequest)({ options, prPayload });
|
|
40
|
-
return number;
|
|
41
|
-
}
|
|
42
|
-
async function deleteBranch(octokit, branchName) {
|
|
43
|
-
await octokit.git.deleteRef({
|
|
44
|
-
owner: TEST_REPO_OWNER,
|
|
45
|
-
repo: TEST_REPO_NAME,
|
|
46
|
-
ref: `heads/${branchName}`,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
async function createBranch(octokit, branchName, sha) {
|
|
50
|
-
await octokit.git.createRef({
|
|
51
|
-
owner: TEST_REPO_OWNER,
|
|
52
|
-
repo: TEST_REPO_NAME,
|
|
53
|
-
ref: `refs/heads/${branchName}`,
|
|
54
|
-
sha,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
// causes flaky test runs on CI because parallel builds are racing each other
|
|
58
|
-
// might also be an issue with Github's API being slow at updating after a mutation happens
|
|
59
|
-
// eslint-disable-next-line jest/no-disabled-tests
|
|
60
|
-
describe.skip('enablePullRequestAutoMerge', () => {
|
|
61
|
-
let pullNumber;
|
|
62
|
-
let branchName;
|
|
63
|
-
let octokit;
|
|
64
|
-
let options;
|
|
65
|
-
beforeAll(async () => {
|
|
66
|
-
const accessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
67
|
-
const randomString = crypto_1.default.randomBytes(4).toString('hex');
|
|
68
|
-
branchName = `test-${randomString}`;
|
|
69
|
-
options = {
|
|
70
|
-
accessToken,
|
|
71
|
-
repoOwner: TEST_REPO_OWNER,
|
|
72
|
-
repoName: TEST_REPO_NAME,
|
|
73
|
-
};
|
|
74
|
-
octokit = new rest_1.Octokit({ auth: accessToken });
|
|
75
|
-
await createBranch(octokit, branchName, COMMIT_SHA);
|
|
76
|
-
pullNumber = await createPr(options, branchName);
|
|
77
|
-
});
|
|
78
|
-
// cleanup
|
|
79
|
-
afterAll(async () => {
|
|
80
|
-
await closePr(octokit, pullNumber);
|
|
81
|
-
await deleteBranch(octokit, branchName);
|
|
82
|
-
});
|
|
83
|
-
// reset auto-merge state between runs
|
|
84
|
-
afterEach(async () => {
|
|
85
|
-
await (0, disablePullRequestAutoMerge_1.disablePullRequestAutoMerge)(options, pullNumber);
|
|
86
|
-
});
|
|
87
|
-
it('should initially have auto-merge disabled', async () => {
|
|
88
|
-
const autoMergeMethod = await (0, fetchPullRequestAutoMergeMethod_1.fetchPullRequestAutoMergeMethod)(options, pullNumber);
|
|
89
|
-
expect(autoMergeMethod).toBe(undefined);
|
|
90
|
-
});
|
|
91
|
-
it('should enable auto-merge via merge', async () => {
|
|
92
|
-
await (0, enablePullRequestAutoMerge_1.enablePullRequestAutoMerge)({ ...options, autoMergeMethod: 'merge' }, pullNumber);
|
|
93
|
-
// ensure Github API reflects the change before querying
|
|
94
|
-
await sleep(100);
|
|
95
|
-
const autoMergeMethod = await (0, fetchPullRequestAutoMergeMethod_1.fetchPullRequestAutoMergeMethod)(options, pullNumber);
|
|
96
|
-
expect(autoMergeMethod).toBe('MERGE');
|
|
97
|
-
});
|
|
98
|
-
it('should not enable auto-merge via rebase because it is disallowed', async () => {
|
|
99
|
-
await (0, enablePullRequestAutoMerge_1.enablePullRequestAutoMerge)({ ...options, autoMergeMethod: 'rebase' }, pullNumber);
|
|
100
|
-
// ensure Github API reflects the change before querying
|
|
101
|
-
await sleep(100);
|
|
102
|
-
const autoMergeMethod = await (0, fetchPullRequestAutoMergeMethod_1.fetchPullRequestAutoMergeMethod)(options, pullNumber);
|
|
103
|
-
expect(autoMergeMethod).toBe(undefined);
|
|
104
|
-
});
|
|
105
|
-
it('should enable auto-merge via squash', async () => {
|
|
106
|
-
await (0, enablePullRequestAutoMerge_1.enablePullRequestAutoMerge)({ ...options, autoMergeMethod: 'squash' }, pullNumber);
|
|
107
|
-
// ensure Github API reflects the change before querying
|
|
108
|
-
await sleep(100);
|
|
109
|
-
const autoMergeMethod = await (0, fetchPullRequestAutoMergeMethod_1.fetchPullRequestAutoMergeMethod)(options, pullNumber);
|
|
110
|
-
expect(autoMergeMethod).toBe('SQUASH');
|
|
111
|
-
});
|
|
112
|
-
});
|