backport 7.3.6 → 8.1.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.
- package/README.md +16 -21
- package/dist/backportRun.d.ts +18 -6
- package/dist/backportRun.js +70 -50
- package/dist/entrypoint.cli.js +4 -8
- package/dist/entrypoint.module.d.ts +13 -6
- package/dist/entrypoint.module.js +17 -19
- package/dist/entrypoint.module.private.test.js +129 -330
- package/dist/errors/BackportError.d.ts +19 -0
- package/dist/errors/BackportError.js +29 -0
- package/dist/lib/BackportError.d.ts +19 -0
- package/dist/lib/BackportError.js +29 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.d.ts +13 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.js +238 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.test.js +321 -0
- package/dist/lib/child-process-promisified.d.ts +25 -0
- package/dist/lib/child-process-promisified.js +58 -0
- package/dist/lib/env.d.ts +7 -0
- package/dist/lib/env.js +33 -0
- package/dist/lib/env.test.d.ts +1 -0
- package/dist/lib/env.test.js +26 -0
- package/dist/lib/getCommits.d.ts +2 -0
- package/dist/lib/getCommits.js +75 -0
- package/dist/lib/getCommitsWithoutBackports.d.ts +11 -0
- package/dist/lib/getCommitsWithoutBackports.js +68 -0
- package/dist/lib/getCommitsWithoutBackports.test.d.ts +1 -0
- package/dist/lib/getCommitsWithoutBackports.test.js +335 -0
- package/dist/lib/getGitConfigAuthor.d.ts +6 -0
- package/dist/lib/getGitConfigAuthor.js +15 -0
- package/dist/lib/getTargetBranches.d.ts +5 -0
- package/dist/lib/getTargetBranches.js +67 -0
- package/dist/lib/getTargetBranches.test.d.ts +1 -0
- package/dist/lib/getTargetBranches.test.js +206 -0
- package/dist/lib/git.d.ts +77 -0
- package/dist/lib/git.js +439 -0
- package/dist/lib/git.private.test.d.ts +1 -0
- package/dist/lib/git.private.test.js +618 -0
- package/dist/lib/git.test.d.ts +1 -0
- package/dist/lib/git.test.js +580 -0
- package/dist/lib/github/commitFormatters.d.ts +3 -0
- package/dist/lib/github/commitFormatters.js +17 -0
- package/dist/lib/github/commitFormatters.test.d.ts +1 -0
- package/dist/lib/github/commitFormatters.test.js +11 -0
- package/dist/lib/github/v3/addAssigneesToPullRequest.d.ts +2 -0
- package/dist/lib/github/v3/addAssigneesToPullRequest.js +32 -0
- package/dist/lib/github/v3/addAssigneesToPullRequest.test.d.ts +1 -0
- package/dist/lib/github/v3/addAssigneesToPullRequest.test.js +27 -0
- package/dist/lib/github/v3/addLabelsToPullRequest.d.ts +2 -0
- package/dist/lib/github/v3/addLabelsToPullRequest.js +30 -0
- package/dist/lib/github/v3/addReviewersToPullRequest.d.ts +2 -0
- package/dist/lib/github/v3/addReviewersToPullRequest.js +32 -0
- package/dist/lib/github/v3/createPullRequest.d.ts +29 -0
- package/dist/lib/github/v3/createPullRequest.js +91 -0
- package/dist/lib/github/v3/createPullRequest.test.d.ts +1 -0
- package/dist/lib/github/v3/createPullRequest.test.js +377 -0
- package/dist/lib/github/v3/createStatusComment.d.ts +11 -0
- package/dist/lib/github/v3/createStatusComment.js +136 -0
- package/dist/lib/github/v3/createStatusComment.test.d.ts +1 -0
- package/dist/lib/github/v3/createStatusComment.test.js +461 -0
- package/dist/lib/github/v3/getGithubV3ErrorMessage.d.ts +14 -0
- package/dist/lib/github/v3/getGithubV3ErrorMessage.js +16 -0
- package/dist/lib/github/v4/FetchPullRequestId.d.ts +2 -0
- package/dist/lib/github/v4/FetchPullRequestId.js +36 -0
- package/dist/lib/github/v4/apiRequestV4.d.ts +31 -0
- package/dist/lib/github/v4/apiRequestV4.js +71 -0
- package/dist/lib/github/v4/apiRequestV4.test.d.ts +1 -0
- package/dist/lib/github/v4/apiRequestV4.test.js +109 -0
- package/dist/lib/github/v4/disablePullRequestAutoMerge.d.ts +2 -0
- package/dist/lib/github/v4/disablePullRequestAutoMerge.js +32 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.d.ts +2 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.js +50 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.d.ts +1 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.js +112 -0
- package/dist/lib/github/v4/fetchAuthorId.d.ts +10 -0
- package/dist/lib/github/v4/fetchAuthorId.js +28 -0
- package/dist/lib/github/v4/fetchAuthorId.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchAuthorId.private.test.js +25 -0
- package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.js +93 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +11 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.js +58 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +136 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.d.ts +11 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.js +48 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.private.test.js +118 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +29 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.js +110 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +196 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +157 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +107 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.d.ts +12 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +69 -0
- package/dist/lib/github/v4/fetchExistingPullRequest.d.ts +9 -0
- package/dist/lib/github/v4/fetchExistingPullRequest.js +64 -0
- package/dist/lib/github/v4/fetchExistingPullRequest.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchExistingPullRequest.private.test.js +44 -0
- package/dist/lib/github/v4/fetchPullRequestAutoMergeMethod.d.ts +2 -0
- package/dist/lib/github/v4/fetchPullRequestAutoMergeMethod.js +39 -0
- package/dist/lib/github/v4/fetchRemoteProjectConfig.d.ts +8 -0
- package/dist/lib/github/v4/fetchRemoteProjectConfig.js +49 -0
- package/dist/lib/github/v4/fetchRemoteProjectConfig.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchRemoteProjectConfig.private.test.js +49 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +72 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +78 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +1 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +116 -0
- package/dist/lib/github/v4/getOptionsFromGithub/query.d.ts +16 -0
- package/dist/lib/github/v4/getOptionsFromGithub/query.js +29 -0
- package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +29 -0
- package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.js +61 -0
- package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.d.ts +1 -0
- package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +72 -0
- package/dist/lib/github/v4/mocks/commitsByAuthorMock.d.ts +2 -0
- package/dist/lib/github/v4/mocks/commitsByAuthorMock.js +176 -0
- package/dist/lib/github/v4/throwOnInvalidAccessToken.d.ts +7 -0
- package/dist/lib/github/v4/throwOnInvalidAccessToken.js +45 -0
- package/dist/lib/github/v4/throwOnInvalidAccessToken.test.d.ts +1 -0
- package/dist/lib/github/v4/throwOnInvalidAccessToken.test.js +87 -0
- package/dist/lib/logger.d.ts +9 -0
- package/dist/lib/logger.js +74 -0
- package/dist/lib/ora.d.ts +2 -0
- package/dist/lib/ora.js +21 -0
- package/dist/lib/prompt.test.d.ts +1 -0
- package/dist/lib/prompt.test.js +139 -0
- package/dist/lib/prompts.d.ts +17 -0
- package/dist/lib/prompts.js +132 -0
- package/dist/lib/remoteConfig.d.ts +20 -0
- package/dist/lib/remoteConfig.js +52 -0
- package/dist/lib/sequentially.d.ts +1 -0
- package/dist/lib/sequentially.js +10 -0
- package/dist/lib/setupRepo.d.ts +2 -0
- package/dist/lib/setupRepo.js +56 -0
- package/dist/lib/setupRepo.test.d.ts +1 -0
- package/dist/lib/setupRepo.test.js +278 -0
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.d.ts +16 -0
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.js +102 -0
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.test.d.ts +1 -0
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.test.js +467 -0
- package/dist/lib/sourceCommit/getMockSourceCommit.d.ts +26 -0
- package/dist/lib/sourceCommit/getMockSourceCommit.js +103 -0
- package/dist/lib/sourceCommit/parseSourceCommit.d.ts +108 -0
- package/dist/lib/sourceCommit/parseSourceCommit.js +123 -0
- package/dist/lib/sourceCommit/parseSourceCommit.test.d.ts +1 -0
- package/dist/lib/sourceCommit/parseSourceCommit.test.js +226 -0
- package/dist/options/ConfigOptions.d.ts +6 -4
- package/dist/options/cliArgs.d.ts +16 -9
- package/dist/options/cliArgs.js +54 -28
- package/dist/options/cliArgs.test.js +128 -4
- package/dist/options/config/config.d.ts +7 -6
- package/dist/options/config/config.js +5 -7
- package/dist/options/config/config.test.js +0 -1
- package/dist/options/config/globalConfig.d.ts +5 -3
- package/dist/options/config/globalConfig.js +17 -14
- package/dist/options/config/projectConfig.d.ts +2 -2
- package/dist/options/config/projectConfig.js +3 -3
- package/dist/options/config/projectConfig.test.js +19 -7
- package/dist/options/config/readConfigFile.d.ts +9 -7
- package/dist/options/config/readConfigFile.js +2 -2
- package/dist/options/options.d.ts +44 -9
- package/dist/options/options.js +22 -27
- package/dist/options/options.test.js +119 -58
- package/dist/runSequentially.d.ts +14 -7
- package/dist/runSequentially.js +26 -11
- package/dist/scripts/postinstall.js +4 -3
- package/dist/scripts/postinstall.test.js +6 -2
- package/dist/services/BackportError.d.ts +19 -0
- package/dist/services/BackportError.js +29 -0
- package/dist/services/HandledBackportError.d.ts +19 -0
- package/dist/services/HandledBackportError.js +29 -0
- package/dist/services/HandledError.d.ts +7 -3
- package/dist/services/HandledError.js +13 -13
- package/dist/services/child-process-promisified.d.ts +19 -3
- package/dist/services/child-process-promisified.js +46 -17
- package/dist/services/git.d.ts +6 -7
- package/dist/services/git.integration.test.js +381 -65
- package/dist/services/git.js +189 -127
- package/dist/services/git.private.test.d.ts +1 -0
- package/dist/services/git.private.test.js +618 -0
- package/dist/services/git.test.js +167 -158
- package/dist/services/github/v3/addAssigneesToPullRequest.js +1 -1
- package/dist/services/github/v3/addLabelsToPullRequest.js +1 -1
- package/dist/services/github/v3/addReviewersToPullRequest.js +2 -1
- package/dist/services/github/v3/createPullRequest.js +4 -2
- package/dist/services/github/v3/createStatusComment.js +17 -17
- package/dist/services/github/v3/createStatusComment.test.js +22 -9
- package/dist/services/github/v4/apiRequestV4.js +8 -11
- package/dist/services/github/v4/apiRequestV4.test.js +2 -2
- package/dist/services/github/v4/enablePullRequestAutoMerge.js +2 -4
- package/dist/services/github/v4/fetchAuthorId.private.test.js +3 -6
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +5 -6
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +4 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +10 -9
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +10 -9
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +4 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +9 -8
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +3 -6
- package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +3 -2
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +3 -6
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +4 -7
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +2 -2
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +2 -2
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +6 -7
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +9 -8
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +5 -5
- package/dist/services/logger.d.ts +1 -4
- package/dist/services/logger.js +14 -19
- package/dist/services/test.d.ts +1 -0
- package/dist/services/test.js +23 -0
- package/dist/state.d.ts +0 -0
- package/dist/state.js +1 -0
- package/dist/test/e2e/cli/commit-author.private.test.js +4 -4
- package/dist/test/e2e/cli/different-merge-strategies.private.test.js +26 -24
- package/dist/test/e2e/cli/entrypoint.cli.private.test.d.ts +1 -0
- package/dist/test/e2e/cli/entrypoint.cli.private.test.js +450 -0
- package/dist/test/e2e/cli/repo-with-backportrc-removed.private.test.js +27 -28
- package/dist/test/e2e/cli/runBackportViaCli.d.ts +6 -2
- package/dist/test/e2e/cli/runBackportViaCli.js +44 -23
- package/dist/test/e2e/cli/test-that-repo-can-be-cloned.private.test.js +22 -14
- package/dist/test/e2e/module/entrypoint.module.mutation.test.d.ts +1 -0
- package/dist/test/e2e/module/entrypoint.module.mutation.test.js +376 -0
- package/dist/test/handleUnbackportedPullRequests.private.test.js +12 -10
- package/dist/test/sandbox.js +5 -1
- package/dist/test/setupFiles/automatic-mocks.js +17 -13
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +11 -7
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +7 -159
- package/dist/ui/getCommits.js +2 -2
- package/dist/ui/getCommitsWithoutBackports.test.js +5 -1
- package/dist/ui/getGitConfigAuthor.js +1 -1
- package/dist/ui/getTargetBranches.js +3 -3
- package/dist/ui/getTargetBranches.test.js +5 -1
- package/dist/ui/ora.d.ts +1 -8
- package/dist/ui/setupRepo.js +3 -3
- package/dist/ui/setupRepo.test.js +98 -61
- package/dist/utils/isErrnoError.d.ts +2 -0
- package/dist/utils/isErrnoError.js +7 -0
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +17 -17
- package/yarn.lock +461 -695
|
@@ -0,0 +1,27 @@
|
|
|
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 addAssigneesToPullRequest_1 = require("./addAssigneesToPullRequest");
|
|
8
|
+
describe('addAssigneesToPullRequest', () => {
|
|
9
|
+
it('should add assignees to PR', async () => {
|
|
10
|
+
const pullNumber = 216;
|
|
11
|
+
const assignees = ['sqren'];
|
|
12
|
+
const scope = (0, nock_1.default)('https://api.github.com')
|
|
13
|
+
.post('/repos/elastic/kibana/issues/216/assignees', {
|
|
14
|
+
assignees: ['sqren'],
|
|
15
|
+
})
|
|
16
|
+
.reply(200, 'some response');
|
|
17
|
+
const res = await (0, addAssigneesToPullRequest_1.addAssigneesToPullRequest)({
|
|
18
|
+
author: 'sqren',
|
|
19
|
+
repoName: 'kibana',
|
|
20
|
+
repoOwner: 'elastic',
|
|
21
|
+
accessToken: 'my-token',
|
|
22
|
+
}, pullNumber, assignees);
|
|
23
|
+
expect(res).toBe(undefined);
|
|
24
|
+
scope.done();
|
|
25
|
+
nock_1.default.cleanAll();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addLabelsToPullRequest = void 0;
|
|
4
|
+
const rest_1 = require("@octokit/rest");
|
|
5
|
+
const ora_1 = require("../../../lib/ora");
|
|
6
|
+
const logger_1 = require("../../logger");
|
|
7
|
+
async function addLabelsToPullRequest({ githubApiBaseUrlV3, repoName, repoOwner, accessToken, interactive, }, pullNumber, labels) {
|
|
8
|
+
const text = `Adding labels: ${labels.join(', ')}`;
|
|
9
|
+
logger_1.logger.info(text);
|
|
10
|
+
const spinner = (0, ora_1.ora)(interactive, text).start();
|
|
11
|
+
try {
|
|
12
|
+
const octokit = new rest_1.Octokit({
|
|
13
|
+
auth: accessToken,
|
|
14
|
+
baseUrl: githubApiBaseUrlV3,
|
|
15
|
+
log: logger_1.logger,
|
|
16
|
+
});
|
|
17
|
+
await octokit.issues.addLabels({
|
|
18
|
+
owner: repoOwner,
|
|
19
|
+
repo: repoName,
|
|
20
|
+
issue_number: pullNumber,
|
|
21
|
+
labels,
|
|
22
|
+
});
|
|
23
|
+
spinner.succeed();
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
spinner.fail();
|
|
27
|
+
logger_1.logger.info(`Could not add labels to PR ${pullNumber}`, e);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.addLabelsToPullRequest = addLabelsToPullRequest;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addReviewersToPullRequest = void 0;
|
|
4
|
+
const rest_1 = require("@octokit/rest");
|
|
5
|
+
const ora_1 = require("../../../lib/ora");
|
|
6
|
+
const logger_1 = require("../../logger");
|
|
7
|
+
async function addReviewersToPullRequest({ githubApiBaseUrlV3, repoName, repoOwner, accessToken, interactive, }, pullNumber, reviewers) {
|
|
8
|
+
const text = `Adding reviewers: ${reviewers}`;
|
|
9
|
+
logger_1.logger.info(text);
|
|
10
|
+
const spinner = (0, ora_1.ora)(interactive, text).start();
|
|
11
|
+
try {
|
|
12
|
+
const octokit = new rest_1.Octokit({
|
|
13
|
+
auth: accessToken,
|
|
14
|
+
baseUrl: githubApiBaseUrlV3,
|
|
15
|
+
log: logger_1.logger,
|
|
16
|
+
});
|
|
17
|
+
await octokit.pulls.requestReviewers({
|
|
18
|
+
owner: repoOwner,
|
|
19
|
+
repo: repoName,
|
|
20
|
+
pull_number: pullNumber,
|
|
21
|
+
reviewers,
|
|
22
|
+
});
|
|
23
|
+
spinner.succeed();
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
//@ts-expect-error
|
|
27
|
+
const message = e.response?.data?.message;
|
|
28
|
+
spinner.fail(`Adding reviewers. ${message ? message : ''}`);
|
|
29
|
+
logger_1.logger.info(`Could not add reviewers to PR ${pullNumber}`, e);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.addReviewersToPullRequest = addReviewersToPullRequest;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ValidConfigOptions } from '../../../options/options';
|
|
2
|
+
import { Commit } from '../../sourceCommit/parseSourceCommit';
|
|
3
|
+
export interface PullRequestPayload {
|
|
4
|
+
owner: string;
|
|
5
|
+
repo: string;
|
|
6
|
+
title: string;
|
|
7
|
+
body: string;
|
|
8
|
+
head: string;
|
|
9
|
+
base: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
export declare function createPullRequest({ options, prPayload, }: {
|
|
13
|
+
options: ValidConfigOptions;
|
|
14
|
+
prPayload: PullRequestPayload;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
url: string;
|
|
17
|
+
number: number;
|
|
18
|
+
didUpdate: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function getPullRequestBody({ options, commits, targetBranch, }: {
|
|
21
|
+
options: ValidConfigOptions;
|
|
22
|
+
commits: Commit[];
|
|
23
|
+
targetBranch: string;
|
|
24
|
+
}): string;
|
|
25
|
+
export declare function getTitle({ options, commits, targetBranch, }: {
|
|
26
|
+
options: ValidConfigOptions;
|
|
27
|
+
commits: Commit[];
|
|
28
|
+
targetBranch: string;
|
|
29
|
+
}): string;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTitle = exports.getPullRequestBody = exports.createPullRequest = void 0;
|
|
4
|
+
const rest_1 = require("@octokit/rest");
|
|
5
|
+
const ora_1 = require("../../../lib/ora");
|
|
6
|
+
const packageVersion_1 = require("../../../utils/packageVersion");
|
|
7
|
+
const BackportError_1 = require("../../BackportError");
|
|
8
|
+
const logger_1 = require("../../logger");
|
|
9
|
+
const commitFormatters_1 = require("../commitFormatters");
|
|
10
|
+
const fetchExistingPullRequest_1 = require("../v4/fetchExistingPullRequest");
|
|
11
|
+
const getGithubV3ErrorMessage_1 = require("./getGithubV3ErrorMessage");
|
|
12
|
+
async function createPullRequest({ options, prPayload, }) {
|
|
13
|
+
logger_1.logger.info(`Creating PR with title: "${prPayload.title}". ${prPayload.head} -> ${prPayload.base}`);
|
|
14
|
+
const { accessToken, githubApiBaseUrlV3 } = options;
|
|
15
|
+
const spinner = (0, ora_1.ora)(options.interactive, `Creating pull request`).start();
|
|
16
|
+
try {
|
|
17
|
+
const octokit = new rest_1.Octokit({
|
|
18
|
+
auth: accessToken,
|
|
19
|
+
baseUrl: githubApiBaseUrlV3,
|
|
20
|
+
log: logger_1.logger,
|
|
21
|
+
});
|
|
22
|
+
const res = await octokit.pulls.create(prPayload);
|
|
23
|
+
spinner.succeed();
|
|
24
|
+
return {
|
|
25
|
+
url: res.data.html_url,
|
|
26
|
+
number: res.data.number,
|
|
27
|
+
didUpdate: false,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
// retrieve url for existing
|
|
32
|
+
try {
|
|
33
|
+
const existingPR = await (0, fetchExistingPullRequest_1.fetchExistingPullRequest)({
|
|
34
|
+
options,
|
|
35
|
+
prPayload,
|
|
36
|
+
});
|
|
37
|
+
if (existingPR) {
|
|
38
|
+
spinner.succeed('Updating existing pull request');
|
|
39
|
+
return {
|
|
40
|
+
url: existingPR.url,
|
|
41
|
+
number: existingPR.number,
|
|
42
|
+
didUpdate: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
logger_1.logger.info('Could not retrieve existing pull request', e);
|
|
48
|
+
// swallow error
|
|
49
|
+
}
|
|
50
|
+
spinner.fail();
|
|
51
|
+
throw new BackportError_1.BackportError(
|
|
52
|
+
//@ts-expect-error
|
|
53
|
+
`Could not create pull request: ${(0, getGithubV3ErrorMessage_1.getGithubV3ErrorMessage)(e)}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.createPullRequest = createPullRequest;
|
|
57
|
+
function getPullRequestBody({ options, commits, targetBranch, }) {
|
|
58
|
+
const commitMessages = commits
|
|
59
|
+
.map((c) => {
|
|
60
|
+
const message = c.sourcePullRequest
|
|
61
|
+
? `[${(0, commitFormatters_1.getFirstLine)(c.sourceCommit.message)}](${c.sourcePullRequest.url})`
|
|
62
|
+
: `${(0, commitFormatters_1.getFirstLine)(c.sourceCommit.message)} (${(0, commitFormatters_1.getShortSha)(c.sourceCommit.sha)})`;
|
|
63
|
+
return ` - ${message}`;
|
|
64
|
+
})
|
|
65
|
+
.join('\n');
|
|
66
|
+
const defaultPrDescription = `# Backport
|
|
67
|
+
|
|
68
|
+
This will backport the following commits from \`${commits[0].sourceBranch}\` to \`${targetBranch}\`:
|
|
69
|
+
${commitMessages}
|
|
70
|
+
|
|
71
|
+
<!--- Backport version: ${packageVersion_1.PACKAGE_VERSION} -->
|
|
72
|
+
|
|
73
|
+
### Questions ?
|
|
74
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)`;
|
|
75
|
+
return (options.prDescription ?? defaultPrDescription)
|
|
76
|
+
.replace('{targetBranch}', targetBranch)
|
|
77
|
+
.replace('{commitMessages}', commitMessages)
|
|
78
|
+
.replace('{defaultPrDescription}', defaultPrDescription);
|
|
79
|
+
}
|
|
80
|
+
exports.getPullRequestBody = getPullRequestBody;
|
|
81
|
+
function getTitle({ options, commits, targetBranch, }) {
|
|
82
|
+
const commitMessages = commits
|
|
83
|
+
.map((c) => (0, commitFormatters_1.getFirstLine)(c.sourceCommit.message))
|
|
84
|
+
.join(' | ');
|
|
85
|
+
const defaultPrTitle = '[{targetBranch}] {commitMessages}';
|
|
86
|
+
return (options.prTitle ?? defaultPrTitle)
|
|
87
|
+
.replace('{targetBranch}', targetBranch)
|
|
88
|
+
.replace('{commitMessages}', commitMessages)
|
|
89
|
+
.slice(0, 240);
|
|
90
|
+
}
|
|
91
|
+
exports.getTitle = getTitle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,377 @@
|
|
|
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
|
+
author: {
|
|
11
|
+
email: 'soren.louv@elastic.co',
|
|
12
|
+
name: 'Søren Louv-Jansen',
|
|
13
|
+
},
|
|
14
|
+
sourcePullRequest: {
|
|
15
|
+
number: 55,
|
|
16
|
+
url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
|
|
17
|
+
mergeCommit: {
|
|
18
|
+
sha: 'abcdefghi',
|
|
19
|
+
message: 'My commit message (#55)',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
sourceCommit: {
|
|
23
|
+
committedDate: '2020',
|
|
24
|
+
sha: 'abcdefghi',
|
|
25
|
+
message: 'My commit message (#55)',
|
|
26
|
+
},
|
|
27
|
+
expectedTargetPullRequests: [],
|
|
28
|
+
sourceBranch: 'master',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
targetBranch: '7.x',
|
|
32
|
+
})).toMatchInlineSnapshot(`
|
|
33
|
+
"# Backport
|
|
34
|
+
|
|
35
|
+
This will backport the following commits from \`master\` to \`7.x\`:
|
|
36
|
+
- [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
|
|
37
|
+
|
|
38
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
39
|
+
|
|
40
|
+
### Questions ?
|
|
41
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
42
|
+
`);
|
|
43
|
+
});
|
|
44
|
+
it('when a single commit (non pull request) is backported', () => {
|
|
45
|
+
expect((0, createPullRequest_1.getPullRequestBody)({
|
|
46
|
+
options: {},
|
|
47
|
+
commits: [
|
|
48
|
+
{
|
|
49
|
+
author: {
|
|
50
|
+
email: 'soren.louv@elastic.co',
|
|
51
|
+
name: 'Søren Louv-Jansen',
|
|
52
|
+
},
|
|
53
|
+
sourceCommit: {
|
|
54
|
+
committedDate: '',
|
|
55
|
+
sha: 'abcdefghijklmw',
|
|
56
|
+
message: 'My commit message',
|
|
57
|
+
},
|
|
58
|
+
sourceBranch: 'main',
|
|
59
|
+
expectedTargetPullRequests: [],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
targetBranch: '7.x',
|
|
63
|
+
})).toMatchInlineSnapshot(`
|
|
64
|
+
"# Backport
|
|
65
|
+
|
|
66
|
+
This will backport the following commits from \`main\` to \`7.x\`:
|
|
67
|
+
- My commit message (abcdefgh)
|
|
68
|
+
|
|
69
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
70
|
+
|
|
71
|
+
### Questions ?
|
|
72
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
73
|
+
`);
|
|
74
|
+
});
|
|
75
|
+
it('when multiple commits are backported', () => {
|
|
76
|
+
expect((0, createPullRequest_1.getPullRequestBody)({
|
|
77
|
+
options: {},
|
|
78
|
+
commits: [
|
|
79
|
+
{
|
|
80
|
+
author: {
|
|
81
|
+
email: 'soren.louv@elastic.co',
|
|
82
|
+
name: 'Søren Louv-Jansen',
|
|
83
|
+
},
|
|
84
|
+
sourcePullRequest: {
|
|
85
|
+
number: 55,
|
|
86
|
+
url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
|
|
87
|
+
mergeCommit: {
|
|
88
|
+
sha: 'abcdefghijklm',
|
|
89
|
+
message: 'My commit message (#55)',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
sourceCommit: {
|
|
93
|
+
committedDate: '',
|
|
94
|
+
sha: 'abcdefghijklm',
|
|
95
|
+
message: 'My commit message (#55)',
|
|
96
|
+
},
|
|
97
|
+
sourceBranch: 'main',
|
|
98
|
+
expectedTargetPullRequests: [],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
author: {
|
|
102
|
+
email: 'soren.louv@elastic.co',
|
|
103
|
+
name: 'Søren Louv-Jansen',
|
|
104
|
+
},
|
|
105
|
+
sourceCommit: {
|
|
106
|
+
committedDate: '',
|
|
107
|
+
sha: 'qwertyuiop',
|
|
108
|
+
message: 'Another commit message',
|
|
109
|
+
},
|
|
110
|
+
sourceBranch: 'main',
|
|
111
|
+
expectedTargetPullRequests: [],
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
targetBranch: '7.x',
|
|
115
|
+
})).toMatchInlineSnapshot(`
|
|
116
|
+
"# Backport
|
|
117
|
+
|
|
118
|
+
This will backport the following commits from \`main\` to \`7.x\`:
|
|
119
|
+
- [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
|
|
120
|
+
- Another commit message (qwertyui)
|
|
121
|
+
|
|
122
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
123
|
+
|
|
124
|
+
### Questions ?
|
|
125
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
126
|
+
`);
|
|
127
|
+
});
|
|
128
|
+
it('when a PR is merged (instead of squashed) and the individual commits are selected', () => {
|
|
129
|
+
expect((0, createPullRequest_1.getPullRequestBody)({
|
|
130
|
+
options: {},
|
|
131
|
+
commits: [
|
|
132
|
+
{
|
|
133
|
+
sourceCommit: {
|
|
134
|
+
committedDate: '2022-02-07T23:53:14Z',
|
|
135
|
+
message: 'Merge strategy: Second commit',
|
|
136
|
+
sha: 'e8df5eaa4db7b94474b48e2320b02d33a830d9fb',
|
|
137
|
+
},
|
|
138
|
+
author: {
|
|
139
|
+
email: 'soren.louv@elastic.co',
|
|
140
|
+
name: 'Søren Louv-Jansen',
|
|
141
|
+
},
|
|
142
|
+
sourcePullRequest: {
|
|
143
|
+
number: 1,
|
|
144
|
+
url: 'https://github.com/backport-org/different-merge-strategies/pull/1',
|
|
145
|
+
mergeCommit: {
|
|
146
|
+
message: 'Merge pull request #1 from backport-org/merge-strategy\n\nMerge commits to `main`',
|
|
147
|
+
sha: '0db7f1ac1233461563d8708511d1c14adbab46da',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
sourceBranch: 'main',
|
|
151
|
+
expectedTargetPullRequests: [],
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
sourceCommit: {
|
|
155
|
+
committedDate: '2022-02-07T23:51:59Z',
|
|
156
|
+
message: 'Merge strategy: First commit',
|
|
157
|
+
sha: '5411b1c1144093e422220008f23f2c2b909ed113',
|
|
158
|
+
},
|
|
159
|
+
author: {
|
|
160
|
+
email: 'soren.louv@elastic.co',
|
|
161
|
+
name: 'Søren Louv-Jansen',
|
|
162
|
+
},
|
|
163
|
+
sourcePullRequest: {
|
|
164
|
+
number: 1,
|
|
165
|
+
url: 'https://github.com/backport-org/different-merge-strategies/pull/1',
|
|
166
|
+
mergeCommit: {
|
|
167
|
+
message: 'Merge pull request #1 from backport-org/merge-strategy\n\nMerge commits to `main`',
|
|
168
|
+
sha: '0db7f1ac1233461563d8708511d1c14adbab46da',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
sourceBranch: 'main',
|
|
172
|
+
expectedTargetPullRequests: [],
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
targetBranch: '7.x',
|
|
176
|
+
})).toMatchInlineSnapshot(`
|
|
177
|
+
"# Backport
|
|
178
|
+
|
|
179
|
+
This will backport the following commits from \`main\` to \`7.x\`:
|
|
180
|
+
- [Merge strategy: Second commit](https://github.com/backport-org/different-merge-strategies/pull/1)
|
|
181
|
+
- [Merge strategy: First commit](https://github.com/backport-org/different-merge-strategies/pull/1)
|
|
182
|
+
|
|
183
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
184
|
+
|
|
185
|
+
### Questions ?
|
|
186
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
|
|
187
|
+
`);
|
|
188
|
+
});
|
|
189
|
+
it('replaces template variables in PR description', () => {
|
|
190
|
+
expect((0, createPullRequest_1.getPullRequestBody)({
|
|
191
|
+
options: {
|
|
192
|
+
prDescription: 'Backporting the following to {targetBranch}:\n{commitMessages}',
|
|
193
|
+
},
|
|
194
|
+
commits: [
|
|
195
|
+
{
|
|
196
|
+
author: {
|
|
197
|
+
email: 'soren.louv@elastic.co',
|
|
198
|
+
name: 'Søren Louv-Jansen',
|
|
199
|
+
},
|
|
200
|
+
sourcePullRequest: {
|
|
201
|
+
number: 55,
|
|
202
|
+
url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
|
|
203
|
+
mergeCommit: {
|
|
204
|
+
sha: 'abcdefghijklm',
|
|
205
|
+
message: 'My commit message (#55)',
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
sourceCommit: {
|
|
209
|
+
committedDate: '',
|
|
210
|
+
sha: 'abcdefghijklm',
|
|
211
|
+
message: 'My commit message (#55)',
|
|
212
|
+
},
|
|
213
|
+
sourceBranch: 'main',
|
|
214
|
+
expectedTargetPullRequests: [],
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
author: {
|
|
218
|
+
email: 'soren.louv@elastic.co',
|
|
219
|
+
name: 'Søren Louv-Jansen',
|
|
220
|
+
},
|
|
221
|
+
sourceCommit: {
|
|
222
|
+
committedDate: '',
|
|
223
|
+
sha: 'qwertyuiop',
|
|
224
|
+
message: 'Another commit message',
|
|
225
|
+
},
|
|
226
|
+
sourceBranch: 'main',
|
|
227
|
+
expectedTargetPullRequests: [],
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
targetBranch: '7.x',
|
|
231
|
+
})).toMatchInlineSnapshot(`
|
|
232
|
+
"Backporting the following to 7.x:
|
|
233
|
+
- [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
|
|
234
|
+
- Another commit message (qwertyui)"
|
|
235
|
+
`);
|
|
236
|
+
});
|
|
237
|
+
it('appends text to the default descriptions', () => {
|
|
238
|
+
expect((0, createPullRequest_1.getPullRequestBody)({
|
|
239
|
+
options: {
|
|
240
|
+
prDescription: '{defaultPrDescription}\n\ntext to append',
|
|
241
|
+
},
|
|
242
|
+
commits: [
|
|
243
|
+
{
|
|
244
|
+
author: {
|
|
245
|
+
email: 'soren.louv@elastic.co',
|
|
246
|
+
name: 'Søren Louv-Jansen',
|
|
247
|
+
},
|
|
248
|
+
sourcePullRequest: {
|
|
249
|
+
number: 55,
|
|
250
|
+
url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
|
|
251
|
+
mergeCommit: {
|
|
252
|
+
sha: 'abcdefghijklm',
|
|
253
|
+
message: 'My commit message (#55)',
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
sourceCommit: {
|
|
257
|
+
committedDate: '',
|
|
258
|
+
sha: 'abcdefghijklm',
|
|
259
|
+
message: 'My commit message (#55)',
|
|
260
|
+
},
|
|
261
|
+
sourceBranch: 'main',
|
|
262
|
+
expectedTargetPullRequests: [],
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
author: {
|
|
266
|
+
email: 'soren.louv@elastic.co',
|
|
267
|
+
name: 'Søren Louv-Jansen',
|
|
268
|
+
},
|
|
269
|
+
sourceCommit: {
|
|
270
|
+
committedDate: '',
|
|
271
|
+
sha: 'qwertyuiop',
|
|
272
|
+
message: 'Another commit message',
|
|
273
|
+
},
|
|
274
|
+
sourceBranch: 'main',
|
|
275
|
+
expectedTargetPullRequests: [],
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
targetBranch: '7.x',
|
|
279
|
+
})).toMatchInlineSnapshot(`
|
|
280
|
+
"# Backport
|
|
281
|
+
|
|
282
|
+
This will backport the following commits from \`main\` to \`7.x\`:
|
|
283
|
+
- [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
|
|
284
|
+
- Another commit message (qwertyui)
|
|
285
|
+
|
|
286
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
287
|
+
|
|
288
|
+
### Questions ?
|
|
289
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
290
|
+
|
|
291
|
+
text to append"
|
|
292
|
+
`);
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
describe('getTitle', () => {
|
|
296
|
+
it('has the default title', () => {
|
|
297
|
+
expect((0, createPullRequest_1.getTitle)({
|
|
298
|
+
options: {},
|
|
299
|
+
commits: [
|
|
300
|
+
{
|
|
301
|
+
author: {
|
|
302
|
+
email: 'soren.louv@elastic.co',
|
|
303
|
+
name: 'Søren Louv-Jansen',
|
|
304
|
+
},
|
|
305
|
+
sourceBranch: 'main',
|
|
306
|
+
sourcePullRequest: {
|
|
307
|
+
number: 55,
|
|
308
|
+
url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
|
|
309
|
+
mergeCommit: {
|
|
310
|
+
sha: 'abcdefghi',
|
|
311
|
+
message: 'My commit message (#55)',
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
sourceCommit: {
|
|
315
|
+
committedDate: '2020',
|
|
316
|
+
sha: 'abcdefghi',
|
|
317
|
+
message: 'My commit message (#55)',
|
|
318
|
+
},
|
|
319
|
+
expectedTargetPullRequests: [],
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
author: {
|
|
323
|
+
email: 'soren.louv@elastic.co',
|
|
324
|
+
name: 'Søren Louv-Jansen',
|
|
325
|
+
},
|
|
326
|
+
sourcePullRequest: {
|
|
327
|
+
number: 56,
|
|
328
|
+
url: 'https://github.com/backport-org/different-merge-strategies/pull/56',
|
|
329
|
+
mergeCommit: {
|
|
330
|
+
sha: 'jklmnopqr',
|
|
331
|
+
message: 'Another commit message (#56)',
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
sourceCommit: {
|
|
335
|
+
committedDate: '2020',
|
|
336
|
+
sha: 'jklmnopqr',
|
|
337
|
+
message: 'Another commit message (#56)',
|
|
338
|
+
},
|
|
339
|
+
sourceBranch: 'main',
|
|
340
|
+
expectedTargetPullRequests: [],
|
|
341
|
+
},
|
|
342
|
+
],
|
|
343
|
+
targetBranch: '7.x',
|
|
344
|
+
})).toEqual('[7.x] My commit message (#55) | Another commit message (#56)');
|
|
345
|
+
});
|
|
346
|
+
it('replaces template variables in PR title', () => {
|
|
347
|
+
expect((0, createPullRequest_1.getTitle)({
|
|
348
|
+
options: {
|
|
349
|
+
prTitle: 'Branch: "{targetBranch}". Messages: {commitMessages}',
|
|
350
|
+
},
|
|
351
|
+
commits: [
|
|
352
|
+
{
|
|
353
|
+
author: {
|
|
354
|
+
email: 'soren.louv@elastic.co',
|
|
355
|
+
name: 'Søren Louv-Jansen',
|
|
356
|
+
},
|
|
357
|
+
sourcePullRequest: {
|
|
358
|
+
number: 55,
|
|
359
|
+
url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
|
|
360
|
+
mergeCommit: {
|
|
361
|
+
sha: 'abcdefghi',
|
|
362
|
+
message: 'My commit message (#55)',
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
sourceCommit: {
|
|
366
|
+
committedDate: '',
|
|
367
|
+
sha: 'abcdefghi',
|
|
368
|
+
message: 'My commit message (#55)',
|
|
369
|
+
},
|
|
370
|
+
sourceBranch: 'main',
|
|
371
|
+
expectedTargetPullRequests: [],
|
|
372
|
+
},
|
|
373
|
+
],
|
|
374
|
+
targetBranch: '7.x',
|
|
375
|
+
})).toEqual('Branch: "7.x". Messages: My commit message (#55)');
|
|
376
|
+
});
|
|
377
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BackportResponse } from '../../../backportRun';
|
|
2
|
+
import { ValidConfigOptions } from '../../../options/options';
|
|
3
|
+
export declare function createStatusComment({ options, backportResponse, }: {
|
|
4
|
+
options: ValidConfigOptions;
|
|
5
|
+
backportResponse: BackportResponse;
|
|
6
|
+
}): Promise<void>;
|
|
7
|
+
export declare function getCommentBody({ options, pullNumber, backportResponse, }: {
|
|
8
|
+
options: ValidConfigOptions;
|
|
9
|
+
pullNumber: number;
|
|
10
|
+
backportResponse: BackportResponse;
|
|
11
|
+
}): string | undefined;
|