backport 8.3.0-beta.1 → 8.4.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/dist/backportRun.js +1 -1
- package/dist/entrypoint.module.d.ts +2 -2
- package/dist/entrypoint.module.js +2 -0
- package/dist/entrypoint.module.private.test.js +11 -10
- package/dist/lib/child-process-promisified.js +2 -2
- package/dist/lib/getCommits.js +1 -1
- package/dist/lib/git.js +3 -1
- package/dist/lib/git.test.js +26 -0
- package/dist/lib/github/v3/createStatusComment.js +3 -2
- package/dist/lib/github/v3/createStatusComment.test.js +61 -0
- package/dist/lib/github/v4/apiRequestV4.js +1 -1
- package/dist/lib/github/v4/enablePullRequestAutoMerge.js +2 -1
- package/dist/{entrypoint.cli.private.test.d.ts → lib/github/v4/enablePullRequestAutoMerge.mutation.test.d.ts} +0 -0
- package/dist/lib/github/v4/{enablePullRequestAutoMerge.private.test.js → enablePullRequestAutoMerge.mutation.test.js} +34 -8
- package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.js +5 -3
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.js +0 -1
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.js +0 -1
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.js +5 -6
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +7 -3
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.d.ts +2 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +23 -7
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +2 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +1 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +2 -0
- package/dist/lib/github/v4/getOptionsFromGithub/query.d.ts +1 -0
- package/dist/lib/github/v4/getOptionsFromGithub/query.js +1 -0
- package/dist/lib/remoteConfig.d.ts +1 -1
- package/dist/lib/remoteConfig.js +4 -0
- package/dist/options/ConfigOptions.d.ts +1 -0
- package/dist/options/cliArgs.d.ts +3 -2
- package/dist/options/cliArgs.js +21 -6
- package/dist/options/config/config.d.ts +1 -0
- package/dist/options/config/readConfigFile.d.ts +1 -0
- package/dist/options/options.d.ts +5 -2
- package/dist/options/options.js +1 -1
- package/dist/options/options.test.js +3 -0
- package/dist/{lib/github/v4/enablePullRequestAutoMerge.private.test.d.ts → test/e2e/cli/date-filters.private.test.d.ts} +0 -0
- package/dist/test/e2e/cli/date-filters.private.test.js +47 -0
- package/dist/test/e2e/cli/entrypoint.cli.private.test.js +4 -18
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +14 -15
- package/yarn.lock +165 -171
- package/dist/entrypoint.cli.private.test.js +0 -47
- package/dist/errors/BackportError.d.ts +0 -19
- package/dist/errors/BackportError.js +0 -29
- package/dist/runSequentially.test.d.ts +0 -1
- package/dist/runSequentially.test.js +0 -243
- package/dist/services/BackportError.d.ts +0 -19
- package/dist/services/BackportError.js +0 -29
- package/dist/services/HandledBackportError.d.ts +0 -19
- package/dist/services/HandledBackportError.js +0 -29
- package/dist/services/HandledError.d.ts +0 -19
- package/dist/services/HandledError.js +0 -29
- package/dist/services/child-process-promisified.d.ts +0 -25
- package/dist/services/child-process-promisified.js +0 -58
- package/dist/services/env.d.ts +0 -7
- package/dist/services/env.js +0 -30
- package/dist/services/env.test.d.ts +0 -1
- package/dist/services/env.test.js +0 -21
- package/dist/services/git.d.ts +0 -77
- package/dist/services/git.integration.test.d.ts +0 -1
- package/dist/services/git.integration.test.js +0 -616
- package/dist/services/git.js +0 -439
- package/dist/services/git.private.test.d.ts +0 -1
- package/dist/services/git.private.test.js +0 -618
- package/dist/services/git.test.d.ts +0 -1
- package/dist/services/git.test.js +0 -580
- package/dist/services/github/commitFormatters.d.ts +0 -3
- package/dist/services/github/commitFormatters.js +0 -17
- 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.d.ts +0 -2
- package/dist/services/github/v3/addAssigneesToPullRequest.js +0 -32
- 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/addLabelsToPullRequest.d.ts +0 -2
- package/dist/services/github/v3/addLabelsToPullRequest.js +0 -30
- package/dist/services/github/v3/addReviewersToPullRequest.d.ts +0 -2
- package/dist/services/github/v3/addReviewersToPullRequest.js +0 -32
- package/dist/services/github/v3/createPullRequest.d.ts +0 -29
- package/dist/services/github/v3/createPullRequest.js +0 -91
- package/dist/services/github/v3/createPullRequest.test.d.ts +0 -1
- package/dist/services/github/v3/createPullRequest.test.js +0 -377
- package/dist/services/github/v3/createStatusComment.d.ts +0 -11
- package/dist/services/github/v3/createStatusComment.js +0 -131
- package/dist/services/github/v3/createStatusComment.test.d.ts +0 -1
- package/dist/services/github/v3/createStatusComment.test.js +0 -409
- package/dist/services/github/v3/getGithubV3ErrorMessage.d.ts +0 -14
- package/dist/services/github/v3/getGithubV3ErrorMessage.js +0 -16
- package/dist/services/github/v4/FetchPullRequestId.d.ts +0 -2
- package/dist/services/github/v4/FetchPullRequestId.js +0 -36
- package/dist/services/github/v4/apiRequestV4.d.ts +0 -31
- package/dist/services/github/v4/apiRequestV4.js +0 -71
- package/dist/services/github/v4/apiRequestV4.test.d.ts +0 -1
- package/dist/services/github/v4/apiRequestV4.test.js +0 -109
- package/dist/services/github/v4/disablePullRequestAutoMerge.d.ts +0 -2
- package/dist/services/github/v4/disablePullRequestAutoMerge.js +0 -32
- package/dist/services/github/v4/enablePullRequestAutoMerge.d.ts +0 -2
- package/dist/services/github/v4/enablePullRequestAutoMerge.js +0 -50
- 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.d.ts +0 -10
- package/dist/services/github/v4/fetchAuthorId.js +0 -28
- package/dist/services/github/v4/fetchAuthorId.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchAuthorId.private.test.js +0 -25
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +0 -93
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +0 -11
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +0 -58
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +0 -136
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.d.ts +0 -11
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +0 -48
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +0 -118
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +0 -29
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +0 -110
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +0 -196
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +0 -157
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +0 -3
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +0 -61
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +0 -107
- package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.d.ts +0 -12
- package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +0 -69
- package/dist/services/github/v4/fetchExistingPullRequest.d.ts +0 -9
- package/dist/services/github/v4/fetchExistingPullRequest.js +0 -64
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +0 -44
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +0 -2
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.js +0 -39
- package/dist/services/github/v4/fetchRemoteProjectConfig.d.ts +0 -8
- package/dist/services/github/v4/fetchRemoteProjectConfig.js +0 -49
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +0 -49
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +0 -69
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +0 -73
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +0 -1
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +0 -116
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +0 -16
- package/dist/services/github/v4/getOptionsFromGithub/query.js +0 -29
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +0 -29
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.js +0 -61
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.d.ts +0 -1
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +0 -72
- package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +0 -176
- package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +0 -6
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +0 -45
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.d.ts +0 -1
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +0 -87
- package/dist/services/logger.d.ts +0 -9
- package/dist/services/logger.js +0 -74
- package/dist/services/prompt.test.d.ts +0 -1
- package/dist/services/prompt.test.js +0 -139
- package/dist/services/prompts.d.ts +0 -17
- package/dist/services/prompts.js +0 -132
- package/dist/services/remoteConfig.d.ts +0 -20
- package/dist/services/remoteConfig.js +0 -52
- package/dist/services/sequentially.d.ts +0 -1
- package/dist/services/sequentially.js +0 -10
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +0 -16
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +0 -102
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +0 -1
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +0 -467
- package/dist/services/sourceCommit/getMockSourceCommit.d.ts +0 -26
- package/dist/services/sourceCommit/getMockSourceCommit.js +0 -103
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +0 -108
- package/dist/services/sourceCommit/parseSourceCommit.js +0 -123
- package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit/parseSourceCommit.test.js +0 -226
- package/dist/services/test.d.ts +0 -1
- package/dist/services/test.js +0 -23
- package/dist/state.d.ts +0 -0
- package/dist/state.js +0 -1
- package/dist/test/ExecError.d.ts +0 -16
- package/dist/test/ExecError.js +0 -15
- package/dist/test/e2e/cli/cli.private.test.d.ts +0 -1
- package/dist/test/e2e/cli/cli.private.test.js +0 -222
- package/dist/test/e2e/cli/interactive-error-handling.private.test.d.ts +0 -1
- package/dist/test/e2e/cli/interactive-error-handling.private.test.js +0 -80
- package/dist/test/e2e/cli/non-interactive-error-handling.private.test.d.ts +0 -1
- package/dist/test/e2e/cli/non-interactive-error-handling.private.test.js +0 -198
- package/dist/test/e2e/cli.e2e.private.test.d.ts +0 -1
- package/dist/test/e2e/cli.e2e.private.test.js +0 -433
- package/dist/test/e2e/module/module.mutation.test.d.ts +0 -1
- package/dist/test/e2e/module/module.mutation.test.js +0 -369
- package/dist/test/e2e/module.e2e.mutation.test.d.ts +0 -1
- package/dist/test/e2e/module.e2e.mutation.test.js +0 -369
- package/dist/test/e2e/module.e2e.private.test.d.ts +0 -1
- package/dist/test/e2e/module.e2e.private.test.js +0 -369
- package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +0 -13
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +0 -243
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +0 -320
- package/dist/ui/getCommits.d.ts +0 -2
- package/dist/ui/getCommits.js +0 -75
- package/dist/ui/getCommitsWithoutBackports.d.ts +0 -11
- package/dist/ui/getCommitsWithoutBackports.js +0 -68
- package/dist/ui/getCommitsWithoutBackports.test.d.ts +0 -1
- package/dist/ui/getCommitsWithoutBackports.test.js +0 -335
- package/dist/ui/getGitConfigAuthor.d.ts +0 -6
- package/dist/ui/getGitConfigAuthor.js +0 -15
- package/dist/ui/getTargetBranches.d.ts +0 -5
- package/dist/ui/getTargetBranches.js +0 -67
- package/dist/ui/getTargetBranches.test.d.ts +0 -1
- package/dist/ui/getTargetBranches.test.js +0 -204
- package/dist/ui/maybeSetupRepo.d.ts +0 -2
- package/dist/ui/maybeSetupRepo.js +0 -53
- package/dist/ui/maybeSetupRepo.test.d.ts +0 -1
- package/dist/ui/maybeSetupRepo.test.js +0 -238
- package/dist/ui/ora.d.ts +0 -2
- package/dist/ui/ora.js +0 -21
- package/dist/ui/setupRepo.d.ts +0 -2
- package/dist/ui/setupRepo.js +0 -56
- package/dist/ui/setupRepo.test.d.ts +0 -1
- package/dist/ui/setupRepo.test.js +0 -273
- package/dist/utils/filterMissingCommits.d.ts +0 -2
- package/dist/utils/filterMissingCommits.js +0 -7
- package/dist/utils/redact.d.ts +0 -1
- package/dist/utils/redact.js +0 -7
package/dist/backportRun.js
CHANGED
|
@@ -102,7 +102,7 @@ async function backportRun({ processArgs, optionsFromModule = {}, exitCodeOnFail
|
|
|
102
102
|
if (exitCodeOnFailure && backportResponse.status === 'failure') {
|
|
103
103
|
process.exitCode = 1;
|
|
104
104
|
}
|
|
105
|
-
logger.error('Unhandled exception', e);
|
|
105
|
+
logger.error('Unhandled exception:', e);
|
|
106
106
|
return backportResponse;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -20,6 +20,8 @@ export declare function getCommits(options: {
|
|
|
20
20
|
repoOwner: string;
|
|
21
21
|
author?: string;
|
|
22
22
|
branchLabelMapping?: ValidConfigOptions['branchLabelMapping'];
|
|
23
|
+
dateSince?: string;
|
|
24
|
+
dateUntil?: string;
|
|
23
25
|
githubApiBaseUrlV4?: string;
|
|
24
26
|
maxNumber?: number;
|
|
25
27
|
onlyMissing?: boolean;
|
|
@@ -28,6 +30,4 @@ export declare function getCommits(options: {
|
|
|
28
30
|
sha?: string | string[];
|
|
29
31
|
skipRemoteConfig?: boolean;
|
|
30
32
|
sourceBranch?: string;
|
|
31
|
-
dateUntil?: string;
|
|
32
|
-
dateSince?: string;
|
|
33
33
|
}): Promise<Commit[]>;
|
|
@@ -243,7 +243,8 @@ describe('entrypoint.module', () => {
|
|
|
243
243
|
accessToken: accessToken,
|
|
244
244
|
repoName: 'kibana',
|
|
245
245
|
repoOwner: 'elastic',
|
|
246
|
-
|
|
246
|
+
dateUntil: '2021-06-02',
|
|
247
|
+
prFilter: 'label:Team:apm base:master',
|
|
247
248
|
maxNumber: 3,
|
|
248
249
|
});
|
|
249
250
|
const commitMessage = commits.map((commit) => {
|
|
@@ -255,19 +256,19 @@ describe('entrypoint.module', () => {
|
|
|
255
256
|
expect(commitMessage).toMatchInlineSnapshot(`
|
|
256
257
|
Array [
|
|
257
258
|
Object {
|
|
258
|
-
"committedDate": "2021-
|
|
259
|
-
"message": "
|
|
260
|
-
"sha": "
|
|
259
|
+
"committedDate": "2021-05-28T12:41:42Z",
|
|
260
|
+
"message": "[Observability] Fix typo in readme for new navigation (#100861)",
|
|
261
|
+
"sha": "79945fe0275b2ec9c93747e26154110133ec51fb",
|
|
261
262
|
},
|
|
262
263
|
Object {
|
|
263
|
-
"committedDate": "2021-
|
|
264
|
-
"message": "
|
|
265
|
-
"sha": "
|
|
264
|
+
"committedDate": "2021-05-28T19:43:30Z",
|
|
265
|
+
"message": "[APM] Move APM tutorial from apm_oss to x-pack/apm (#100780)",
|
|
266
|
+
"sha": "0bcd78b0e999feb95057f5e6eafdb572b9b2fe39",
|
|
266
267
|
},
|
|
267
268
|
Object {
|
|
268
|
-
"committedDate": "2021-
|
|
269
|
-
"message": "
|
|
270
|
-
"sha": "
|
|
269
|
+
"committedDate": "2021-05-18T10:33:16Z",
|
|
270
|
+
"message": "Migrate from Joi to @kbn/config-schema in \\"home\\" and \\"features\\" plugins (#100201)",
|
|
271
|
+
"sha": "574f6595ad2e5452fa90e6a3111220a599e473c0",
|
|
271
272
|
},
|
|
272
273
|
]
|
|
273
274
|
`);
|
|
@@ -17,6 +17,8 @@ async function exec(cmd, options) {
|
|
|
17
17
|
}
|
|
18
18
|
exports.exec = exec;
|
|
19
19
|
async function spawnPromise(cmd, cmdArgs, cwd) {
|
|
20
|
+
const fullCmd = `${cmd} ${cmdArgs.join(' ')}`;
|
|
21
|
+
logger_1.logger.info(`Running command: "${fullCmd}"`);
|
|
20
22
|
return new Promise(function (resolve, reject) {
|
|
21
23
|
const subprocess = child_process_1.default.spawn(cmd, cmdArgs, { cwd });
|
|
22
24
|
let stderr = '';
|
|
@@ -28,8 +30,6 @@ async function spawnPromise(cmd, cmdArgs, cwd) {
|
|
|
28
30
|
stderr += data;
|
|
29
31
|
});
|
|
30
32
|
subprocess.on('close', (code) => {
|
|
31
|
-
const fullCmd = `${cmd} ${cmdArgs.join(' ')}`;
|
|
32
|
-
logger_1.logger.info(`Running command: "${fullCmd}"`);
|
|
33
33
|
if (code === 0 || code === null) {
|
|
34
34
|
resolve({ cmdArgs, code, stderr, stdout });
|
|
35
35
|
}
|
package/dist/lib/getCommits.js
CHANGED
|
@@ -46,7 +46,7 @@ async function getCommits(options) {
|
|
|
46
46
|
spinner.text = options.prFilter
|
|
47
47
|
? 'Loading pull requests...'
|
|
48
48
|
: `Loading commits from branch "${options.sourceBranch}"...`;
|
|
49
|
-
const commitChoices = options.prFilter
|
|
49
|
+
const commitChoices = options.prFilter !== undefined
|
|
50
50
|
? await (0, fetchPullRequestsBySearchQuery_1.fetchPullRequestsBySearchQuery)({
|
|
51
51
|
...options,
|
|
52
52
|
prFilter: options.prFilter,
|
package/dist/lib/git.js
CHANGED
|
@@ -15,6 +15,7 @@ function getRemoteUrl({ repoName, accessToken, gitHostname = 'github.com' }, rep
|
|
|
15
15
|
}
|
|
16
16
|
exports.getRemoteUrl = getRemoteUrl;
|
|
17
17
|
async function cloneRepo({ sourcePath, targetPath }, onProgress) {
|
|
18
|
+
logger_1.logger.info(`Cloning repo from ${sourcePath} to ${targetPath}`);
|
|
18
19
|
return new Promise((resolve, reject) => {
|
|
19
20
|
const subprocess = (0, child_process_promisified_1.spawnOriginal)('git', [
|
|
20
21
|
'clone',
|
|
@@ -28,7 +29,7 @@ async function cloneRepo({ sourcePath, targetPath }, onProgress) {
|
|
|
28
29
|
};
|
|
29
30
|
subprocess.on('error', (err) => reject(err));
|
|
30
31
|
subprocess.stderr.on('data', (data) => {
|
|
31
|
-
logger_1.logger.verbose(data);
|
|
32
|
+
logger_1.logger.verbose(data.toString());
|
|
32
33
|
const [, objectReceiveProgress] = data.toString().match(/^Receiving objects:\s+(\d+)%/) || [];
|
|
33
34
|
if (objectReceiveProgress) {
|
|
34
35
|
progress.objectReceive = parseInt(objectReceiveProgress, 10);
|
|
@@ -228,6 +229,7 @@ async function cherrypick({ options, sha, mergedTargetPullRequest, commitAuthor,
|
|
|
228
229
|
? ['--mainline', `${options.mainline}`]
|
|
229
230
|
: []),
|
|
230
231
|
...(options.cherrypickRef === false ? [] : ['-x']),
|
|
232
|
+
...(options.signoff ? ['--signoff'] : []),
|
|
231
233
|
shaOrRange,
|
|
232
234
|
];
|
|
233
235
|
try {
|
package/dist/lib/git.test.js
CHANGED
|
@@ -340,6 +340,32 @@ describe('cherrypick', () => {
|
|
|
340
340
|
'/myHomeDir/.backport/repositories/elastic/kibana',
|
|
341
341
|
]);
|
|
342
342
|
});
|
|
343
|
+
it('should use signoff option when specified', async () => {
|
|
344
|
+
const spawnSpy = jest
|
|
345
|
+
.spyOn(childProcess, 'spawnPromise')
|
|
346
|
+
.mockResolvedValueOnce({ stderr: '', stdout: '', code: 0, cmdArgs: [] }) // mock getIsMergeCommit(...)
|
|
347
|
+
.mockResolvedValueOnce({ stderr: '', stdout: '', code: 0, cmdArgs: [] }); // mock cherrypick(...)
|
|
348
|
+
await (0, git_1.cherrypick)({
|
|
349
|
+
options: { ...options, signoff: true },
|
|
350
|
+
sha: 'abcd',
|
|
351
|
+
commitAuthor,
|
|
352
|
+
});
|
|
353
|
+
const args = spawnSpy.mock.calls[1];
|
|
354
|
+
expect(args).toEqual([
|
|
355
|
+
'git',
|
|
356
|
+
[
|
|
357
|
+
'-c',
|
|
358
|
+
'user.name="Soren L"',
|
|
359
|
+
'-c',
|
|
360
|
+
'user.email="soren@mail.dk"',
|
|
361
|
+
'cherry-pick',
|
|
362
|
+
'-x',
|
|
363
|
+
'--signoff',
|
|
364
|
+
'abcd',
|
|
365
|
+
],
|
|
366
|
+
'/myHomeDir/.backport/repositories/elastic/kibana',
|
|
367
|
+
]);
|
|
368
|
+
});
|
|
343
369
|
it('should return `needsResolving: true` upon cherrypick error', async () => {
|
|
344
370
|
jest
|
|
345
371
|
.spyOn(childProcess, 'spawnPromise')
|
|
@@ -42,7 +42,7 @@ async function createStatusComment({ options, backportResponse, }) {
|
|
|
42
42
|
}
|
|
43
43
|
exports.createStatusComment = createStatusComment;
|
|
44
44
|
function getCommentBody({ options, pullNumber, backportResponse, }) {
|
|
45
|
-
const { repoName, repoOwner, autoMerge, publishStatusCommentOnAbort, publishStatusCommentOnFailure, publishStatusCommentOnSuccess, } = options;
|
|
45
|
+
const { repoName, repoOwner, autoMerge, isRepoPrivate, publishStatusCommentOnAbort, publishStatusCommentOnFailure, publishStatusCommentOnSuccess, } = options;
|
|
46
46
|
// eg. in addition to `--noStatusComment` add `--noFailureStatusComment` and `--noSuccessStatusComment` where the former will overwrite the two latter
|
|
47
47
|
const didAllBackportsSucceed = backportResponse.status === 'success' &&
|
|
48
48
|
backportResponse.results.every((r) => r.status === 'success');
|
|
@@ -86,10 +86,11 @@ ${manualBackportCommand}${questionsAndLinkToBackport}${packageVersionSection}`;
|
|
|
86
86
|
const tableBody = backportResponse.results
|
|
87
87
|
.map((result) => {
|
|
88
88
|
if (result.status === 'success') {
|
|
89
|
+
const prShield = `[<img src="https://img.shields.io/github/pulls/detail/state/${repoOwner}/${repoName}/${result.pullRequestNumber}">](${result.pullRequestUrl})`;
|
|
89
90
|
return [
|
|
90
91
|
'✅',
|
|
91
92
|
result.targetBranch,
|
|
92
|
-
|
|
93
|
+
isRepoPrivate ? result.pullRequestUrl : prShield,
|
|
93
94
|
];
|
|
94
95
|
}
|
|
95
96
|
if (result.error instanceof BackportError_1.BackportError &&
|
|
@@ -563,4 +563,65 @@ describe('getCommentBody', () => {
|
|
|
563
563
|
expect((0, createStatusComment_1.getCommentBody)(params)).toBe(undefined);
|
|
564
564
|
});
|
|
565
565
|
});
|
|
566
|
+
describe('shield.io badges', () => {
|
|
567
|
+
const getParams = (opts) => ({
|
|
568
|
+
options: {
|
|
569
|
+
interactive: true,
|
|
570
|
+
repoName: 'kibana',
|
|
571
|
+
repoOwner: 'elastic',
|
|
572
|
+
autoMerge: true,
|
|
573
|
+
backportBinary: 'node scripts/backport',
|
|
574
|
+
publishStatusCommentOnSuccess: true,
|
|
575
|
+
...opts,
|
|
576
|
+
},
|
|
577
|
+
pullNumber: 55,
|
|
578
|
+
backportResponse: {
|
|
579
|
+
status: 'success',
|
|
580
|
+
results: [
|
|
581
|
+
{
|
|
582
|
+
status: 'success',
|
|
583
|
+
targetBranch: '7.x',
|
|
584
|
+
pullRequestNumber: 55,
|
|
585
|
+
pullRequestUrl: 'url-to-pr',
|
|
586
|
+
},
|
|
587
|
+
],
|
|
588
|
+
},
|
|
589
|
+
});
|
|
590
|
+
it('posts a comment without shields.io badge when repo is private`', () => {
|
|
591
|
+
const params = getParams({ isRepoPrivate: true });
|
|
592
|
+
expect((0, createStatusComment_1.getCommentBody)(params)).not.toContain('img.shields.io');
|
|
593
|
+
expect((0, createStatusComment_1.getCommentBody)(params)).toMatchInlineSnapshot(`
|
|
594
|
+
"## 💚 All backports created successfully
|
|
595
|
+
|
|
596
|
+
| Status | Branch | Result |
|
|
597
|
+
|:------:|:------:|:------|
|
|
598
|
+
|✅|7.x|url-to-pr|
|
|
599
|
+
|
|
600
|
+
Note: Successful backport PRs will be merged automatically after passing CI.
|
|
601
|
+
|
|
602
|
+
### Questions ?
|
|
603
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
604
|
+
|
|
605
|
+
<!--- Backport version: 1.2.3-mocked -->"
|
|
606
|
+
`);
|
|
607
|
+
});
|
|
608
|
+
it('posts a comment with shields.io badge when repo is public`', () => {
|
|
609
|
+
const params = getParams({ isRepoPrivate: false });
|
|
610
|
+
expect((0, createStatusComment_1.getCommentBody)(params)).toContain('img.shields.io');
|
|
611
|
+
expect((0, createStatusComment_1.getCommentBody)(params)).toMatchInlineSnapshot(`
|
|
612
|
+
"## 💚 All backports created successfully
|
|
613
|
+
|
|
614
|
+
| Status | Branch | Result |
|
|
615
|
+
|:------:|:------:|:------|
|
|
616
|
+
|✅|7.x|[<img src=\\"https://img.shields.io/github/pulls/detail/state/elastic/kibana/55\\">](url-to-pr)|
|
|
617
|
+
|
|
618
|
+
Note: Successful backport PRs will be merged automatically after passing CI.
|
|
619
|
+
|
|
620
|
+
### Questions ?
|
|
621
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
622
|
+
|
|
623
|
+
<!--- Backport version: 1.2.3-mocked -->"
|
|
624
|
+
`);
|
|
625
|
+
});
|
|
626
|
+
});
|
|
566
627
|
});
|
|
@@ -45,7 +45,7 @@ exports.apiRequestV4 = apiRequestV4;
|
|
|
45
45
|
function addDebugLogs({ githubApiBaseUrlV4, query, variables, githubResponse, didThrow = false, }) {
|
|
46
46
|
const gqlQueryName = getQueryName(query);
|
|
47
47
|
logger_1.logger.info(`POST ${githubApiBaseUrlV4} (name:${gqlQueryName}, status: ${githubResponse.status}${didThrow ? ', EXCEPTION THROWN' : ''})`);
|
|
48
|
-
logger_1.logger.verbose(`Query: ${query}`);
|
|
48
|
+
logger_1.logger.verbose(`Query: ${(0, printer_1.print)(query)}`);
|
|
49
49
|
logger_1.logger.verbose('Variables:', variables);
|
|
50
50
|
logger_1.logger.verbose('Response headers:', githubResponse.headers);
|
|
51
51
|
logger_1.logger.verbose('Response data:', githubResponse.data);
|
|
@@ -43,8 +43,9 @@ async function enablePullRequestAutoMerge(options, targetPullRequestNumber) {
|
|
|
43
43
|
return res.enablePullRequestAutoMerge.pullRequest?.number;
|
|
44
44
|
}
|
|
45
45
|
catch (e) {
|
|
46
|
+
const err = e;
|
|
46
47
|
spinner.fail();
|
|
47
|
-
logger_1.logger.info(`Could not enable auto merging for ${targetPullRequestNumber}`, e);
|
|
48
|
+
logger_1.logger.info(`Could not enable auto merging for ${targetPullRequestNumber} due to ${err.message}`, e);
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
exports.enablePullRequestAutoMerge = enablePullRequestAutoMerge;
|
|
File without changes
|
|
@@ -15,10 +15,18 @@ const fetchPullRequestAutoMergeMethod_1 = require("./fetchPullRequestAutoMergeMe
|
|
|
15
15
|
// otherwise it will be merged when auto-merge is turned on
|
|
16
16
|
const TEST_REPO_OWNER = 'backport-org';
|
|
17
17
|
const TEST_REPO_NAME = 'repo-with-auto-merge-enabled';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const COMMIT_SHA = '1a88d210f90a22e2a06253c5760909833dc820e9';
|
|
18
|
+
const INITIAL_SHA = '70aa879411e95b6662f8ddcb80a944fc4444579f';
|
|
19
|
+
jest.setTimeout(10000);
|
|
21
20
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
21
|
+
function resetReference(octokit) {
|
|
22
|
+
return octokit.rest.git.updateRef({
|
|
23
|
+
owner: TEST_REPO_OWNER,
|
|
24
|
+
repo: TEST_REPO_NAME,
|
|
25
|
+
ref: 'heads/main',
|
|
26
|
+
sha: INITIAL_SHA,
|
|
27
|
+
force: true,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
22
30
|
async function closePr(octokit, pullNumber) {
|
|
23
31
|
await octokit.pulls.update({
|
|
24
32
|
owner: TEST_REPO_OWNER,
|
|
@@ -29,7 +37,7 @@ async function closePr(octokit, pullNumber) {
|
|
|
29
37
|
}
|
|
30
38
|
async function createPr(options, branchName) {
|
|
31
39
|
const prPayload = {
|
|
32
|
-
base: '
|
|
40
|
+
base: '7.x',
|
|
33
41
|
head: branchName,
|
|
34
42
|
body: 'testing...',
|
|
35
43
|
owner: TEST_REPO_OWNER,
|
|
@@ -54,10 +62,23 @@ async function createBranch(octokit, branchName, sha) {
|
|
|
54
62
|
sha,
|
|
55
63
|
});
|
|
56
64
|
}
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
async function addCommit(octokit) {
|
|
66
|
+
const randomString = Math.random().toString(36).slice(2);
|
|
67
|
+
const res = await octokit.rest.repos.createOrUpdateFileContents({
|
|
68
|
+
owner: TEST_REPO_OWNER,
|
|
69
|
+
repo: TEST_REPO_NAME,
|
|
70
|
+
path: `file-to-change-${randomString}`,
|
|
71
|
+
message: 'Automatically changed',
|
|
72
|
+
content: Buffer.from(`My new hash ${randomString}`).toString('base64'),
|
|
73
|
+
branch: 'main',
|
|
74
|
+
});
|
|
75
|
+
const sha = res.data.commit.sha;
|
|
76
|
+
return sha;
|
|
77
|
+
}
|
|
78
|
+
// Error: cannot have more than 100 pull requests with the same head_sha
|
|
79
|
+
// TODO: have unique head sha for every test run
|
|
59
80
|
// eslint-disable-next-line jest/no-disabled-tests
|
|
60
|
-
describe
|
|
81
|
+
describe('enablePullRequestAutoMerge', () => {
|
|
61
82
|
let pullNumber;
|
|
62
83
|
let branchName;
|
|
63
84
|
let octokit;
|
|
@@ -72,13 +93,18 @@ describe.skip('enablePullRequestAutoMerge', () => {
|
|
|
72
93
|
repoName: TEST_REPO_NAME,
|
|
73
94
|
};
|
|
74
95
|
octokit = new rest_1.Octokit({ auth: accessToken });
|
|
75
|
-
await
|
|
96
|
+
await resetReference(octokit);
|
|
97
|
+
const sha = await addCommit(octokit);
|
|
98
|
+
if (sha) {
|
|
99
|
+
await createBranch(octokit, branchName, sha);
|
|
100
|
+
}
|
|
76
101
|
pullNumber = await createPr(options, branchName);
|
|
77
102
|
});
|
|
78
103
|
// cleanup
|
|
79
104
|
afterAll(async () => {
|
|
80
105
|
await closePr(octokit, pullNumber);
|
|
81
106
|
await deleteBranch(octokit, branchName);
|
|
107
|
+
await resetReference(octokit);
|
|
82
108
|
});
|
|
83
109
|
// reset auto-merge state between runs
|
|
84
110
|
afterEach(async () => {
|
|
@@ -47,13 +47,15 @@ describe('allFetchers', () => {
|
|
|
47
47
|
});
|
|
48
48
|
it('matches commitByAuthor with commitBySearchQuery', async () => {
|
|
49
49
|
const commitsBySearchQuery = await (0, fetchPullRequestsBySearchQuery_1.fetchPullRequestsBySearchQuery)({
|
|
50
|
-
repoOwner: 'elastic',
|
|
51
|
-
repoName: 'kibana',
|
|
52
50
|
accessToken,
|
|
51
|
+
author: 'sqren',
|
|
52
|
+
dateSince: null,
|
|
53
|
+
dateUntil: null,
|
|
53
54
|
maxNumber: 1,
|
|
54
55
|
prFilter: `created:2021-12-20..2021-12-20`,
|
|
56
|
+
repoName: 'kibana',
|
|
57
|
+
repoOwner: 'elastic',
|
|
55
58
|
sourceBranch: 'main',
|
|
56
|
-
author: 'sqren',
|
|
57
59
|
});
|
|
58
60
|
const commitBySearchQuery = commitsBySearchQuery[0];
|
|
59
61
|
expect(commitByAuthor).toEqual(commitBySearchQuery);
|
|
@@ -14,17 +14,17 @@ const parseSourceCommit_1 = require("../../../sourceCommit/parseSourceCommit");
|
|
|
14
14
|
const apiRequestV4_1 = require("../apiRequestV4");
|
|
15
15
|
const fetchAuthorId_1 = require("../fetchAuthorId");
|
|
16
16
|
async function fetchByCommitPath({ options, authorId, commitPath, }) {
|
|
17
|
-
const { accessToken, githubApiBaseUrlV4 = 'https://api.github.com/graphql', maxNumber = 10, repoName, repoOwner, sourceBranch,
|
|
17
|
+
const { accessToken, dateSince, dateUntil, githubApiBaseUrlV4 = 'https://api.github.com/graphql', maxNumber = 10, repoName, repoOwner, sourceBranch, } = options;
|
|
18
18
|
const query = (0, graphql_tag_1.default) `
|
|
19
19
|
query CommitsByAuthor(
|
|
20
|
-
$repoOwner: String!
|
|
21
|
-
$repoName: String!
|
|
22
|
-
$maxNumber: Int!
|
|
23
|
-
$sourceBranch: String!
|
|
24
20
|
$authorId: ID
|
|
25
21
|
$commitPath: String
|
|
26
22
|
$dateSince: GitTimestamp
|
|
27
23
|
$dateUntil: GitTimestamp
|
|
24
|
+
$maxNumber: Int!
|
|
25
|
+
$repoName: String!
|
|
26
|
+
$repoOwner: String!
|
|
27
|
+
$sourceBranch: String!
|
|
28
28
|
) {
|
|
29
29
|
repository(owner: $repoOwner, name: $repoName) {
|
|
30
30
|
ref(qualifiedName: $sourceBranch) {
|
|
@@ -70,7 +70,6 @@ async function fetchByCommitPath({ options, authorId, commitPath, }) {
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
catch (e) {
|
|
73
|
-
//@ts-expect-error
|
|
74
73
|
return (0, remoteConfig_1.swallowMissingConfigFileException)(e);
|
|
75
74
|
}
|
|
76
75
|
}
|
|
@@ -8,17 +8,19 @@ describe('fetchPullRequestsBySearchQuery', () => {
|
|
|
8
8
|
it('throws an error', async () => {
|
|
9
9
|
const options = {
|
|
10
10
|
accessToken,
|
|
11
|
+
author: 'sqren',
|
|
12
|
+
dateSince: null,
|
|
13
|
+
dateUntil: null,
|
|
11
14
|
maxNumber: 10,
|
|
12
15
|
prFilter: 'label:non-existing',
|
|
13
16
|
repoName: 'backport-e2e',
|
|
14
17
|
repoOwner: 'backport-org',
|
|
15
18
|
sourceBranch: 'master',
|
|
16
|
-
author: 'sqren',
|
|
17
19
|
};
|
|
18
20
|
await expect((0, fetchPullRequestsBySearchQuery_1.fetchPullRequestsBySearchQuery)(options)).rejects
|
|
19
21
|
.toThrowErrorMatchingInlineSnapshot(`
|
|
20
22
|
"No commits found for query:
|
|
21
|
-
type:pr is:merged sort:
|
|
23
|
+
type:pr is:merged sort:created-desc repo:backport-org/backport-e2e author:sqren base:master label:non-existing
|
|
22
24
|
|
|
23
25
|
Use \`--all\` to see commits by all users or \`--author=<username>\` for commits from a specific user"
|
|
24
26
|
`);
|
|
@@ -28,12 +30,14 @@ describe('fetchPullRequestsBySearchQuery', () => {
|
|
|
28
30
|
it('returns the merge commits for those PRs', async () => {
|
|
29
31
|
const options = {
|
|
30
32
|
accessToken,
|
|
33
|
+
author: 'sqren',
|
|
34
|
+
dateSince: null,
|
|
35
|
+
dateUntil: null,
|
|
31
36
|
maxNumber: 10,
|
|
32
37
|
prFilter: 'label:v7.8.0',
|
|
33
38
|
repoName: 'backport-e2e',
|
|
34
39
|
repoOwner: 'backport-org',
|
|
35
40
|
sourceBranch: 'master',
|
|
36
|
-
author: 'sqren',
|
|
37
41
|
};
|
|
38
42
|
const expectedCommits = [
|
|
39
43
|
{
|
|
@@ -2,6 +2,8 @@ import { Commit } from '../../../sourceCommit/parseSourceCommit';
|
|
|
2
2
|
export declare function fetchPullRequestsBySearchQuery(options: {
|
|
3
3
|
accessToken: string;
|
|
4
4
|
author: string | null;
|
|
5
|
+
dateSince: string | null;
|
|
6
|
+
dateUntil: string | null;
|
|
5
7
|
githubApiBaseUrlV4?: string;
|
|
6
8
|
maxNumber?: number;
|
|
7
9
|
onlyMissing?: boolean;
|
|
@@ -12,7 +12,7 @@ const remoteConfig_1 = require("../../../remoteConfig");
|
|
|
12
12
|
const parseSourceCommit_1 = require("../../../sourceCommit/parseSourceCommit");
|
|
13
13
|
const apiRequestV4_1 = require("../apiRequestV4");
|
|
14
14
|
async function fetchPullRequestsBySearchQuery(options) {
|
|
15
|
-
const { accessToken, githubApiBaseUrlV4 = 'https://api.github.com/graphql', maxNumber = 10, prFilter, repoName, repoOwner, sourceBranch,
|
|
15
|
+
const { accessToken, author, dateSince, dateUntil, githubApiBaseUrlV4 = 'https://api.github.com/graphql', maxNumber = 10, prFilter, repoName, repoOwner, sourceBranch, } = options;
|
|
16
16
|
const query = (0, graphql_tag_1.default) `
|
|
17
17
|
query PullRequestBySearchQuery($query: String!, $maxNumber: Int!) {
|
|
18
18
|
search(query: $query, type: ISSUE, first: $maxNumber) {
|
|
@@ -28,11 +28,28 @@ async function fetchPullRequestsBySearchQuery(options) {
|
|
|
28
28
|
|
|
29
29
|
${parseSourceCommit_1.SourceCommitWithTargetPullRequestFragment}
|
|
30
30
|
`;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
function dateFilter() {
|
|
32
|
+
if (dateUntil && dateSince) {
|
|
33
|
+
return [`merged:${dateSince}..${dateUntil}`];
|
|
34
|
+
}
|
|
35
|
+
if (dateUntil) {
|
|
36
|
+
return [`merged:<${dateUntil}`];
|
|
37
|
+
}
|
|
38
|
+
if (dateSince) {
|
|
39
|
+
return [`merged:>${dateSince}`];
|
|
40
|
+
}
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
const searchQuery = [
|
|
44
|
+
'type:pr',
|
|
45
|
+
'is:merged',
|
|
46
|
+
'sort:created-desc',
|
|
47
|
+
`repo:${repoOwner}/${repoName}`,
|
|
48
|
+
...(options.author ? [`author:${options.author}`] : []),
|
|
49
|
+
...(prFilter.includes('base:') ? [] : [`base:${sourceBranch}`]),
|
|
50
|
+
...dateFilter(),
|
|
51
|
+
prFilter,
|
|
52
|
+
].join(' ');
|
|
36
53
|
const variables = {
|
|
37
54
|
query: searchQuery,
|
|
38
55
|
maxNumber,
|
|
@@ -47,7 +64,6 @@ async function fetchPullRequestsBySearchQuery(options) {
|
|
|
47
64
|
});
|
|
48
65
|
}
|
|
49
66
|
catch (e) {
|
|
50
|
-
//@ts-expect-error
|
|
51
67
|
res = (0, remoteConfig_1.swallowMissingConfigFileException)(e);
|
|
52
68
|
}
|
|
53
69
|
const commits = res.search.nodes.map((pullRequestNode) => {
|
|
@@ -61,6 +61,7 @@ export declare function getOptionsFromGithub(options: {
|
|
|
61
61
|
targetBranchChoices?: import("../../../../options/ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
62
62
|
targetBranches?: string[] | undefined;
|
|
63
63
|
targetPRLabels?: string[] | undefined;
|
|
64
|
+
signoff?: boolean | undefined;
|
|
64
65
|
help?: boolean | undefined;
|
|
65
66
|
version?: boolean | undefined;
|
|
66
67
|
v?: boolean | undefined;
|
|
@@ -69,4 +70,5 @@ export declare function getOptionsFromGithub(options: {
|
|
|
69
70
|
branches?: import("../../../../options/ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
70
71
|
labels?: string[] | undefined;
|
|
71
72
|
authenticatedUsername: string;
|
|
73
|
+
isRepoPrivate: boolean;
|
|
72
74
|
}>;
|
|
@@ -40,6 +40,7 @@ describe('getOptionsFromGithub', () => {
|
|
|
40
40
|
'^v7.9.0$': '7.x',
|
|
41
41
|
'^v8.0.0$': 'master',
|
|
42
42
|
},
|
|
43
|
+
isRepoPrivate: false,
|
|
43
44
|
sourceBranch: 'master',
|
|
44
45
|
targetBranchChoices: [
|
|
45
46
|
{ checked: true, name: 'master' },
|
|
@@ -109,6 +110,7 @@ describe('getOptionsFromGithub', () => {
|
|
|
109
110
|
const options = await (0, getOptionsFromGithub_1.getOptionsFromGithub)(combinedOptions);
|
|
110
111
|
expect(options).toEqual({
|
|
111
112
|
authenticatedUsername: 'sqren',
|
|
113
|
+
isRepoPrivate: false,
|
|
112
114
|
sourceBranch: 'main',
|
|
113
115
|
});
|
|
114
116
|
});
|
|
@@ -17,4 +17,4 @@ export interface RemoteConfigHistory {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
export declare function parseRemoteConfig(remoteConfig: RemoteConfig): ConfigFileOptions | undefined;
|
|
20
|
-
export declare function swallowMissingConfigFileException<T>(error: GithubV4Exception<T>): T;
|
|
20
|
+
export declare function swallowMissingConfigFileException<T>(error: GithubV4Exception<T> | unknown): T;
|
package/dist/lib/remoteConfig.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.swallowMissingConfigFileException = exports.parseRemoteConfig = exports.RemoteConfigHistoryFragment = void 0;
|
|
7
7
|
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
8
|
const readConfigFile_1 = require("../options/config/readConfigFile");
|
|
9
|
+
const apiRequestV4_1 = require("./github/v4/apiRequestV4");
|
|
9
10
|
const logger_1 = require("./logger");
|
|
10
11
|
exports.RemoteConfigHistoryFragment = (0, graphql_tag_1.default) `
|
|
11
12
|
fragment RemoteConfigHistoryFragment on Commit {
|
|
@@ -38,6 +39,9 @@ function parseRemoteConfig(remoteConfig) {
|
|
|
38
39
|
}
|
|
39
40
|
exports.parseRemoteConfig = parseRemoteConfig;
|
|
40
41
|
function swallowMissingConfigFileException(error) {
|
|
42
|
+
if (!(error instanceof apiRequestV4_1.GithubV4Exception)) {
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
41
45
|
const { data, errors } = error.githubResponse.data;
|
|
42
46
|
const missingConfigError = errors?.some((error) => {
|
|
43
47
|
return error.path?.includes('remoteConfig') && error.type === 'NOT_FOUND';
|
|
@@ -15,6 +15,8 @@ export declare function getOptionsFromCliArgs(processArgs: readonly string[]): {
|
|
|
15
15
|
cherrypickRef?: boolean | undefined;
|
|
16
16
|
projectConfigFile?: string | undefined;
|
|
17
17
|
globalConfigFile?: string | undefined;
|
|
18
|
+
dateSince?: string | undefined;
|
|
19
|
+
dateUntil?: string | undefined;
|
|
18
20
|
details?: boolean | undefined;
|
|
19
21
|
dryRun?: boolean | undefined;
|
|
20
22
|
editor?: string | undefined;
|
|
@@ -26,6 +28,7 @@ export declare function getOptionsFromCliArgs(processArgs: readonly string[]): {
|
|
|
26
28
|
gitAuthorEmail?: string | undefined;
|
|
27
29
|
ls?: boolean | undefined;
|
|
28
30
|
mainline?: number | undefined;
|
|
31
|
+
signoff?: boolean | undefined;
|
|
29
32
|
maxNumber?: number | undefined;
|
|
30
33
|
multipleBranches?: boolean | undefined;
|
|
31
34
|
multipleCommits?: boolean | undefined;
|
|
@@ -41,8 +44,6 @@ export declare function getOptionsFromCliArgs(processArgs: readonly string[]): {
|
|
|
41
44
|
repoOwner?: string | undefined;
|
|
42
45
|
repoName?: string | undefined;
|
|
43
46
|
sourceBranch?: string | undefined;
|
|
44
|
-
dateSince?: string | undefined;
|
|
45
|
-
dateUntil?: string | undefined;
|
|
46
47
|
commitPaths?: string[] | undefined;
|
|
47
48
|
reviewers?: string[] | undefined;
|
|
48
49
|
sourcePRLabels?: string[] | undefined;
|