backport 6.3.0-beta-2 → 6.3.0-beta-6
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 +6 -2
- package/dist/entrypoint.cli.e2e.private.test.js +3 -2
- package/dist/options/ConfigOptions.d.ts +3 -2
- package/dist/options/cliArgs.d.ts +1 -0
- package/dist/options/cliArgs.js +24 -4
- package/dist/options/config/config.d.ts +2 -7
- package/dist/options/config/readConfigFile.d.ts +2 -7
- package/dist/options/options.d.ts +2 -7
- package/dist/options/options.test.js +3 -5
- package/dist/runSequentially.js +1 -0
- package/dist/services/github/v3/index.d.ts +1 -0
- package/dist/services/github/v3/index.js +61 -0
- package/dist/services/github/v4/apiRequestV4.js +10 -2
- package/dist/services/github/v4/fetchAuthorId.private.test.js +2 -2
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +1 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +2 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +2 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +2 -2
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +2 -2
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +2 -2
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +2 -2
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +3 -7
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +8 -7
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +1 -1
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +15 -24
- package/dist/services/github/v4/getOptionsFromGithub/query.js +17 -25
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +2 -2
- package/dist/services/logger.d.ts +3 -15
- package/dist/services/logger.js +10 -50
- package/dist/test/private/getDevAccessToken.d.ts +2 -1
- package/dist/test/private/getDevAccessToken.js +6 -19
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +5 -3
- package/yarn.lock +5 -0
package/dist/backportRun.js
CHANGED
|
@@ -30,10 +30,14 @@ async function backportRun(processArgs, optionsFromModule = {}) {
|
|
|
30
30
|
let commits = [];
|
|
31
31
|
try {
|
|
32
32
|
options = await (0, options_1.getOptions)(processArgs, optionsFromModule);
|
|
33
|
+
logger_1.logger.info('Backporting options', options);
|
|
33
34
|
spinner.stop();
|
|
34
35
|
commits = await (0, getCommits_1.getCommits)(options);
|
|
36
|
+
logger_1.logger.info('Commits', commits);
|
|
35
37
|
const targetBranches = await (0, getTargetBranches_1.getTargetBranches)(options, commits);
|
|
38
|
+
logger_1.logger.info('Target branches', targetBranches);
|
|
36
39
|
const results = await (0, runSequentially_1.runSequentially)({ options, commits, targetBranches });
|
|
40
|
+
logger_1.logger.info('Results', results);
|
|
37
41
|
const backportResponse = {
|
|
38
42
|
status: 'success',
|
|
39
43
|
commits,
|
|
@@ -70,9 +74,9 @@ async function backportRun(processArgs, optionsFromModule = {}) {
|
|
|
70
74
|
(0, logger_1.consoleLog)(chalk_1.default.italic(`For additional details see the logs: ${(0, env_1.getLogfilePath)({
|
|
71
75
|
logFilePath,
|
|
72
76
|
})}`));
|
|
73
|
-
// write to log
|
|
74
|
-
logger_1.logger.info('Unknown error:', e);
|
|
75
77
|
}
|
|
78
|
+
logger_1.logger.error('Unhandled exception', e);
|
|
79
|
+
process.exitCode = 1;
|
|
76
80
|
return backportResponse;
|
|
77
81
|
}
|
|
78
82
|
}
|
|
@@ -13,8 +13,8 @@ const TIMEOUT_IN_SECONDS = 10;
|
|
|
13
13
|
jest.setTimeout(15000);
|
|
14
14
|
describe('inquirer cli', () => {
|
|
15
15
|
let devAccessToken;
|
|
16
|
-
beforeAll(
|
|
17
|
-
devAccessToken =
|
|
16
|
+
beforeAll(() => {
|
|
17
|
+
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
18
18
|
});
|
|
19
19
|
it('--version', async () => {
|
|
20
20
|
const res = await runBackportAsync([`--version`]);
|
|
@@ -71,6 +71,7 @@ describe('inquirer cli', () => {
|
|
|
71
71
|
--reviewer Add reviewer to the target PR [array]
|
|
72
72
|
--repoOwner Repository owner [string]
|
|
73
73
|
--repoName Repository name [string]
|
|
74
|
+
--repo Repo owner and name [string]
|
|
74
75
|
--sha, --commit Commit sha to backport [string]
|
|
75
76
|
--sourceBranch Specify a non-default branch (normally \\"master\\") to backport
|
|
76
77
|
from [string]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import winston from 'winston';
|
|
2
2
|
export interface TargetBranchChoice {
|
|
3
3
|
name: string;
|
|
4
4
|
checked?: boolean;
|
|
@@ -7,7 +7,7 @@ export declare type TargetBranchChoiceOrString = string | TargetBranchChoice;
|
|
|
7
7
|
declare type AutoFixConflictsHandler = ({ files, directory, logger, targetBranch, }: {
|
|
8
8
|
files: string[];
|
|
9
9
|
directory: string;
|
|
10
|
-
logger: Logger;
|
|
10
|
+
logger: winston.Logger;
|
|
11
11
|
targetBranch: string;
|
|
12
12
|
}) => boolean | Promise<boolean>;
|
|
13
13
|
declare type Options = Partial<{
|
|
@@ -52,6 +52,7 @@ declare type Options = Partial<{
|
|
|
52
52
|
targetBranchChoices: TargetBranchChoiceOrString[];
|
|
53
53
|
targetBranches: string[];
|
|
54
54
|
targetPRLabels: string[];
|
|
55
|
+
username: string;
|
|
55
56
|
verbose: boolean;
|
|
56
57
|
}>;
|
|
57
58
|
export declare type ConfigFileOptions = Options & Partial<{
|
|
@@ -35,6 +35,7 @@ export declare function getOptionsFromCliArgs(processArgs: readonly string[], {
|
|
|
35
35
|
repoOwner?: string | undefined;
|
|
36
36
|
repoName?: string | undefined;
|
|
37
37
|
sourceBranch?: string | undefined;
|
|
38
|
+
username?: string | undefined;
|
|
38
39
|
dateSince?: string | undefined;
|
|
39
40
|
dateUntil?: string | undefined;
|
|
40
41
|
commitPaths?: string[] | undefined;
|
package/dist/options/cliArgs.js
CHANGED
|
@@ -47,6 +47,12 @@ function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
|
47
47
|
description: 'Sets auto-merge method when using --auto-merge. Default: merge',
|
|
48
48
|
type: 'string',
|
|
49
49
|
choices: ['merge', 'rebase', 'squash'],
|
|
50
|
+
})
|
|
51
|
+
.option('author', {
|
|
52
|
+
description: 'Show commits by a specific user',
|
|
53
|
+
alias: 'author',
|
|
54
|
+
type: 'string',
|
|
55
|
+
conflicts: 'all',
|
|
50
56
|
})
|
|
51
57
|
.option('ci', {
|
|
52
58
|
description: 'Disable interactive prompts',
|
|
@@ -210,10 +216,17 @@ function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
|
210
216
|
.option('repoOwner', {
|
|
211
217
|
description: 'Repository owner',
|
|
212
218
|
type: 'string',
|
|
219
|
+
conflicts: ['repo'],
|
|
213
220
|
})
|
|
214
221
|
.option('repoName', {
|
|
215
222
|
description: 'Repository name',
|
|
216
223
|
type: 'string',
|
|
224
|
+
conflicts: ['repo'],
|
|
225
|
+
})
|
|
226
|
+
.option('repo', {
|
|
227
|
+
description: 'Repo owner and name',
|
|
228
|
+
type: 'string',
|
|
229
|
+
conflicts: ['repoName', 'repoOwner'],
|
|
217
230
|
})
|
|
218
231
|
.option('sha', {
|
|
219
232
|
conflicts: ['pullNumber', 'prFilter'],
|
|
@@ -248,11 +261,9 @@ function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
|
248
261
|
type: 'array',
|
|
249
262
|
string: true,
|
|
250
263
|
})
|
|
251
|
-
.option('
|
|
252
|
-
description: '
|
|
253
|
-
alias: 'author',
|
|
264
|
+
.option('username', {
|
|
265
|
+
description: 'User repo that branch will be pushed to. Defaults to the authenticated user',
|
|
254
266
|
type: 'string',
|
|
255
|
-
conflicts: 'all',
|
|
256
267
|
})
|
|
257
268
|
.option('verbose', {
|
|
258
269
|
description: 'Show additional debug information',
|
|
@@ -283,14 +294,23 @@ function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
|
283
294
|
$0, _,
|
|
284
295
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
285
296
|
multiple, multipleBranches, multipleCommits, all,
|
|
297
|
+
// repoName and repoOwner
|
|
298
|
+
repo,
|
|
286
299
|
// filters
|
|
287
300
|
author, since, until,
|
|
288
301
|
// negations
|
|
289
302
|
noCherrypickRef, noFork, noStatusComment, noVerify, verify,
|
|
290
303
|
// array types (should be renamed to plural form)
|
|
291
304
|
assignee, path, reviewer, sourcePRLabel, targetBranch, targetBranchChoice, targetPRLabel, ...restOptions } = yargsInstance.parseSync();
|
|
305
|
+
const [repoOwner, repoName] = repo?.split('/') ?? [
|
|
306
|
+
restOptions.repoOwner,
|
|
307
|
+
restOptions.repoName,
|
|
308
|
+
];
|
|
292
309
|
return (0, excludeUndefined_1.excludeUndefined)({
|
|
293
310
|
...restOptions,
|
|
311
|
+
// repoName and repoOwner
|
|
312
|
+
repoOwner,
|
|
313
|
+
repoName,
|
|
294
314
|
// filters
|
|
295
315
|
author: all ? null : author,
|
|
296
316
|
dateSince: since ? new Date(since).toISOString() : undefined,
|
|
@@ -13,13 +13,7 @@ export declare function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsF
|
|
|
13
13
|
autoFixConflicts?: (({ files, directory, logger, targetBranch, }: {
|
|
14
14
|
files: string[];
|
|
15
15
|
directory: string;
|
|
16
|
-
logger:
|
|
17
|
-
error: (message: string, meta?: unknown) => void;
|
|
18
|
-
warn: (message: string, meta?: unknown) => void;
|
|
19
|
-
info: (message: string, meta?: unknown) => void;
|
|
20
|
-
verbose: (message: string, meta?: unknown) => void;
|
|
21
|
-
debug: (message: string, meta?: unknown) => void;
|
|
22
|
-
};
|
|
16
|
+
logger: import("winston").Logger;
|
|
23
17
|
targetBranch: string;
|
|
24
18
|
}) => boolean | Promise<boolean>) | undefined;
|
|
25
19
|
autoMerge?: boolean | undefined;
|
|
@@ -58,6 +52,7 @@ export declare function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsF
|
|
|
58
52
|
targetBranchChoices?: import("../ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
59
53
|
targetBranches?: string[] | undefined;
|
|
60
54
|
targetPRLabels?: string[] | undefined;
|
|
55
|
+
username?: string | undefined;
|
|
61
56
|
verbose?: boolean | undefined;
|
|
62
57
|
help?: boolean | undefined;
|
|
63
58
|
version?: boolean | undefined;
|
|
@@ -35,6 +35,7 @@ export declare function withConfigMigrations({ upstream, labels, branches, ...co
|
|
|
35
35
|
repoOwner?: string | undefined;
|
|
36
36
|
repoName?: string | undefined;
|
|
37
37
|
sourceBranch?: string | undefined;
|
|
38
|
+
username?: string | undefined;
|
|
38
39
|
version?: boolean | undefined;
|
|
39
40
|
commitPaths?: string[] | undefined;
|
|
40
41
|
reviewers?: string[] | undefined;
|
|
@@ -46,13 +47,7 @@ export declare function withConfigMigrations({ upstream, labels, branches, ...co
|
|
|
46
47
|
autoFixConflicts?: (({ files, directory, logger, targetBranch, }: {
|
|
47
48
|
files: string[];
|
|
48
49
|
directory: string;
|
|
49
|
-
logger:
|
|
50
|
-
error: (message: string, meta?: unknown) => void;
|
|
51
|
-
warn: (message: string, meta?: unknown) => void;
|
|
52
|
-
info: (message: string, meta?: unknown) => void;
|
|
53
|
-
verbose: (message: string, meta?: unknown) => void;
|
|
54
|
-
debug: (message: string, meta?: unknown) => void;
|
|
55
|
-
};
|
|
50
|
+
logger: import("winston").Logger;
|
|
56
51
|
targetBranch: string;
|
|
57
52
|
}) => boolean | Promise<boolean>) | undefined;
|
|
58
53
|
backportBinary?: string | undefined;
|
|
@@ -34,6 +34,7 @@ export declare function getOptions(processArgs: string[], optionsFromModule: Con
|
|
|
34
34
|
sha?: string | undefined;
|
|
35
35
|
resetAuthor: boolean;
|
|
36
36
|
sourceBranch: string;
|
|
37
|
+
username?: string | undefined;
|
|
37
38
|
dateSince: string | null;
|
|
38
39
|
dateUntil: string | null;
|
|
39
40
|
commitPaths: string[];
|
|
@@ -50,13 +51,7 @@ export declare function getOptions(processArgs: string[], optionsFromModule: Con
|
|
|
50
51
|
autoFixConflicts?: (({ files, directory, logger, targetBranch, }: {
|
|
51
52
|
files: string[];
|
|
52
53
|
directory: string;
|
|
53
|
-
logger:
|
|
54
|
-
error: (message: string, meta?: unknown) => void;
|
|
55
|
-
warn: (message: string, meta?: unknown) => void;
|
|
56
|
-
info: (message: string, meta?: unknown) => void;
|
|
57
|
-
verbose: (message: string, meta?: unknown) => void;
|
|
58
|
-
debug: (message: string, meta?: unknown) => void;
|
|
59
|
-
};
|
|
54
|
+
logger: import("winston").Logger;
|
|
60
55
|
targetBranch: string;
|
|
61
56
|
}) => boolean | Promise<boolean>) | undefined;
|
|
62
57
|
backportBinary: string;
|
|
@@ -110,7 +110,7 @@ describe('getOptions', () => {
|
|
|
110
110
|
});
|
|
111
111
|
});
|
|
112
112
|
it('should ensure that "backport" branch does not exist', async () => {
|
|
113
|
-
mockGithubConfigOptions({
|
|
113
|
+
mockGithubConfigOptions({ hasBackportBranch: true });
|
|
114
114
|
await expect((0, options_1.getOptions)([], {})).rejects.toThrowError('You must delete the branch "backport" to continue. See https://github.com/sqren/backport/issues/155 for details');
|
|
115
115
|
});
|
|
116
116
|
it('should merge config options and module options', async () => {
|
|
@@ -308,7 +308,7 @@ function mockProjectConfig(projectConfig) {
|
|
|
308
308
|
},
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
|
-
function mockGithubConfigOptions({ viewerLogin = 'DO_NOT_USE-sqren', defaultBranchRef = 'DO_NOT_USE-default-branch-name',
|
|
311
|
+
function mockGithubConfigOptions({ viewerLogin = 'DO_NOT_USE-sqren', defaultBranchRef = 'DO_NOT_USE-default-branch-name', hasBackportBranch, historicalMappings = [], }) {
|
|
312
312
|
return (0, nockHelpers_1.mockGqlRequest)({
|
|
313
313
|
name: 'GithubConfigOptions',
|
|
314
314
|
statusCode: 200,
|
|
@@ -318,9 +318,7 @@ function mockGithubConfigOptions({ viewerLogin = 'DO_NOT_USE-sqren', defaultBran
|
|
|
318
318
|
login: viewerLogin,
|
|
319
319
|
},
|
|
320
320
|
repository: {
|
|
321
|
-
|
|
322
|
-
parent: null,
|
|
323
|
-
ref: refName ? { name: refName } : null,
|
|
321
|
+
illegalBackportBranch: hasBackportBranch ? { id: 'foo' } : null,
|
|
324
322
|
defaultBranchRef: {
|
|
325
323
|
name: defaultBranchRef,
|
|
326
324
|
target: {
|
package/dist/runSequentially.js
CHANGED
|
@@ -32,6 +32,7 @@ async function runSequentially({ options, commits, targetBranches, }) {
|
|
|
32
32
|
error: e,
|
|
33
33
|
});
|
|
34
34
|
(0, logger_1.consoleLog)(e.message);
|
|
35
|
+
logger_1.logger.error('Could not backport commit', e);
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
// return the results for consumers to programatically read
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
const core = __importStar(require("@actions/core"));
|
|
23
|
+
const exec_1 = require("@actions/exec");
|
|
24
|
+
const github_1 = require("@actions/github");
|
|
25
|
+
const backport_1 = require("backport");
|
|
26
|
+
async function init() {
|
|
27
|
+
const { payload, repo } = github_1.context;
|
|
28
|
+
if (!payload.pull_request) {
|
|
29
|
+
throw Error('Only pull_request events are supported.');
|
|
30
|
+
}
|
|
31
|
+
const pullRequest = payload.pull_request;
|
|
32
|
+
const prAuthor = pullRequest.user.login;
|
|
33
|
+
const accessToken = core.getInput('github_token', { required: true });
|
|
34
|
+
const commitUser = core.getInput('commit_user', { required: false });
|
|
35
|
+
const commitEmail = core.getInput('commit_email', { required: false });
|
|
36
|
+
const autoMerge = core.getInput('auto_merge', { required: false }) === 'true';
|
|
37
|
+
const autoMergeMethod = core.getInput('auto_merge_method', {
|
|
38
|
+
required: false,
|
|
39
|
+
});
|
|
40
|
+
const targetPRLabels = core
|
|
41
|
+
.getInput('target_pr_labels', { required: false })
|
|
42
|
+
.split(',')
|
|
43
|
+
.map((label) => label.trim());
|
|
44
|
+
await (0, exec_1.exec)(`git config --global user.name "${commitUser}"`);
|
|
45
|
+
await (0, exec_1.exec)(`git config --global user.email "${commitEmail}"`);
|
|
46
|
+
await (0, backport_1.backportRun)({
|
|
47
|
+
repoOwner: repo.owner,
|
|
48
|
+
repoName: repo.repo,
|
|
49
|
+
accessToken,
|
|
50
|
+
ci: true,
|
|
51
|
+
pullNumber: pullRequest.number,
|
|
52
|
+
targetPRLabels: targetPRLabels,
|
|
53
|
+
assignees: [prAuthor],
|
|
54
|
+
autoMerge: autoMerge,
|
|
55
|
+
autoMergeMethod: autoMergeMethod,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
init().catch((error) => {
|
|
59
|
+
console.error('An error occurred', error);
|
|
60
|
+
core.setFailed(error.message);
|
|
61
|
+
});
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.GithubV4Exception = exports.apiRequestV4 = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
9
|
const HandledError_1 = require("../../HandledError");
|
|
9
10
|
const logger_1 = require("../../logger");
|
|
10
11
|
async function apiRequestV4({ githubApiBaseUrlV4 = 'https://api.github.com/graphql', accessToken, query, variables, }) {
|
|
@@ -46,9 +47,11 @@ async function apiRequestV4({ githubApiBaseUrlV4 = 'https://api.github.com/graph
|
|
|
46
47
|
}
|
|
47
48
|
exports.apiRequestV4 = apiRequestV4;
|
|
48
49
|
function addDebugLogs({ githubApiBaseUrlV4, query, variables, axiosResponse, didSucceed, }) {
|
|
49
|
-
|
|
50
|
+
const gqlQueryName = getGqlQueryName(query);
|
|
51
|
+
logger_1.logger.info(`POST ${githubApiBaseUrlV4} (name:${gqlQueryName}, status: ${axiosResponse.status})`);
|
|
50
52
|
const logMethod = didSucceed ? logger_1.logger.verbose : logger_1.logger.info;
|
|
51
|
-
logMethod(
|
|
53
|
+
logMethod(`Query name ${gqlQueryName}`);
|
|
54
|
+
logMethod(`Query: ${query}`);
|
|
52
55
|
logMethod('Variables:', variables);
|
|
53
56
|
logMethod('Response headers:', axiosResponse.headers);
|
|
54
57
|
logMethod('Response data:', axiosResponse.data);
|
|
@@ -63,3 +66,8 @@ class GithubV4Exception extends Error {
|
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
exports.GithubV4Exception = GithubV4Exception;
|
|
69
|
+
function getGqlQueryName(query) {
|
|
70
|
+
const ast = (0, graphql_tag_1.default)(query);
|
|
71
|
+
//@ts-expect-error
|
|
72
|
+
return ast.definitions[0].name.value;
|
|
73
|
+
}
|
|
@@ -4,8 +4,8 @@ const getDevAccessToken_1 = require("../../../test/private/getDevAccessToken");
|
|
|
4
4
|
const fetchAuthorId_1 = require("./fetchAuthorId");
|
|
5
5
|
describe('fetchAuthorId', () => {
|
|
6
6
|
let devAccessToken;
|
|
7
|
-
beforeAll(
|
|
8
|
-
devAccessToken =
|
|
7
|
+
beforeAll(() => {
|
|
8
|
+
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
9
|
});
|
|
10
10
|
describe('author = null', () => {
|
|
11
11
|
it('returns null', async () => {
|
|
@@ -9,7 +9,7 @@ describe('allFetchers', () => {
|
|
|
9
9
|
let devAccessToken;
|
|
10
10
|
let commitByAuthor;
|
|
11
11
|
beforeEach(async () => {
|
|
12
|
-
devAccessToken =
|
|
12
|
+
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
13
13
|
const commitsByAuthor = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
14
14
|
accessToken: devAccessToken,
|
|
15
15
|
author: 'sqren',
|
|
@@ -28,8 +28,8 @@ const apiRequestV4Module = __importStar(require("../apiRequestV4"));
|
|
|
28
28
|
const fetchCommitByPullNumber_1 = require("./fetchCommitByPullNumber");
|
|
29
29
|
describe('fetchCommitByPullNumber', () => {
|
|
30
30
|
let devAccessToken;
|
|
31
|
-
beforeAll(
|
|
32
|
-
devAccessToken =
|
|
31
|
+
beforeAll(() => {
|
|
32
|
+
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
33
33
|
});
|
|
34
34
|
describe('snapshot request/response', () => {
|
|
35
35
|
let spy;
|
|
@@ -28,8 +28,8 @@ const apiRequestV4Module = __importStar(require("../apiRequestV4"));
|
|
|
28
28
|
const fetchCommitBySha_1 = require("./fetchCommitBySha");
|
|
29
29
|
describe('fetchCommitBySha', () => {
|
|
30
30
|
let devAccessToken;
|
|
31
|
-
beforeEach(
|
|
32
|
-
devAccessToken =
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
33
33
|
});
|
|
34
34
|
describe('snapshot request/response', () => {
|
|
35
35
|
let spy;
|
|
@@ -28,8 +28,8 @@ const apiRequestV4Module = __importStar(require("../apiRequestV4"));
|
|
|
28
28
|
const fetchCommitsByAuthor_1 = require("./fetchCommitsByAuthor");
|
|
29
29
|
describe('fetchCommitsByAuthor', () => {
|
|
30
30
|
let devAccessToken;
|
|
31
|
-
beforeAll(
|
|
32
|
-
devAccessToken =
|
|
31
|
+
beforeAll(() => {
|
|
32
|
+
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
33
33
|
});
|
|
34
34
|
describe('snapshot request/response', () => {
|
|
35
35
|
let spy;
|
|
@@ -4,8 +4,8 @@ const getDevAccessToken_1 = require("../../../../test/private/getDevAccessToken"
|
|
|
4
4
|
const fetchPullRequestBySearchQuery_1 = require("./fetchPullRequestBySearchQuery");
|
|
5
5
|
describe('fetchPullRequestBySearchQuery', () => {
|
|
6
6
|
let devAccessToken;
|
|
7
|
-
beforeAll(
|
|
8
|
-
devAccessToken =
|
|
7
|
+
beforeAll(() => {
|
|
8
|
+
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
9
|
});
|
|
10
10
|
describe('when filter does not match any PRs', () => {
|
|
11
11
|
it('throws an error', async () => {
|
|
@@ -4,8 +4,8 @@ const getDevAccessToken_1 = require("../../../test/private/getDevAccessToken");
|
|
|
4
4
|
const fetchExistingPullRequest_1 = require("./fetchExistingPullRequest");
|
|
5
5
|
describe('fetchExistingPullRequest', () => {
|
|
6
6
|
let devAccessToken;
|
|
7
|
-
beforeAll(
|
|
8
|
-
devAccessToken =
|
|
7
|
+
beforeAll(() => {
|
|
8
|
+
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
9
|
});
|
|
10
10
|
describe('when PR does not exist', () => {
|
|
11
11
|
it('returns undefined', async () => {
|
|
@@ -4,8 +4,8 @@ const getDevAccessToken_1 = require("../../../test/private/getDevAccessToken");
|
|
|
4
4
|
const fetchRemoteProjectConfig_1 = require("./fetchRemoteProjectConfig");
|
|
5
5
|
describe('fetchRemoteProjectConfig', () => {
|
|
6
6
|
let devAccessToken;
|
|
7
|
-
beforeEach(
|
|
8
|
-
devAccessToken =
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
9
9
|
});
|
|
10
10
|
it('returns the backport config from "main" branch', async () => {
|
|
11
11
|
const projectConfig = await (0, fetchRemoteProjectConfig_1.fetchRemoteProjectConfig)({
|
|
@@ -3,6 +3,7 @@ export declare function getOptionsFromGithub(options: {
|
|
|
3
3
|
githubApiBaseUrlV4?: string;
|
|
4
4
|
repoName: string;
|
|
5
5
|
repoOwner: string;
|
|
6
|
+
username?: string;
|
|
6
7
|
skipRemoteConfig?: boolean;
|
|
7
8
|
cwd?: string;
|
|
8
9
|
}): Promise<{
|
|
@@ -17,13 +18,7 @@ export declare function getOptionsFromGithub(options: {
|
|
|
17
18
|
autoFixConflicts?: (({ files, directory, logger, targetBranch, }: {
|
|
18
19
|
files: string[];
|
|
19
20
|
directory: string;
|
|
20
|
-
logger:
|
|
21
|
-
error: (message: string, meta?: unknown) => void;
|
|
22
|
-
warn: (message: string, meta?: unknown) => void;
|
|
23
|
-
info: (message: string, meta?: unknown) => void;
|
|
24
|
-
verbose: (message: string, meta?: unknown) => void;
|
|
25
|
-
debug: (message: string, meta?: unknown) => void;
|
|
26
|
-
};
|
|
21
|
+
logger: import("winston").Logger;
|
|
27
22
|
targetBranch: string;
|
|
28
23
|
}) => boolean | Promise<boolean>) | undefined;
|
|
29
24
|
autoMerge?: boolean | undefined;
|
|
@@ -62,6 +57,7 @@ export declare function getOptionsFromGithub(options: {
|
|
|
62
57
|
targetBranchChoices?: import("../../../../options/ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
63
58
|
targetBranches?: string[] | undefined;
|
|
64
59
|
targetPRLabels?: string[] | undefined;
|
|
60
|
+
username?: string | undefined;
|
|
65
61
|
verbose?: boolean | undefined;
|
|
66
62
|
help?: boolean | undefined;
|
|
67
63
|
version?: boolean | undefined;
|
|
@@ -32,19 +32,20 @@ async function getOptionsFromGithub(options) {
|
|
|
32
32
|
(0, throwOnInvalidAccessToken_1.throwOnInvalidAccessToken)({ error, repoName, repoOwner });
|
|
33
33
|
res = swallowErrorIfConfigFileIsMissing(error);
|
|
34
34
|
}
|
|
35
|
-
// get the original repo (not the fork)
|
|
36
|
-
const repo = res.repository.isFork ? res.repository.parent : res.repository;
|
|
37
35
|
// it is not possible to have a branch named "backport"
|
|
38
|
-
if (
|
|
36
|
+
if (res.repository.illegalBackportBranch) {
|
|
39
37
|
throw new HandledError_1.HandledError('You must delete the branch "backport" to continue. See https://github.com/sqren/backport/issues/155 for details');
|
|
40
38
|
}
|
|
41
|
-
const historicalRemoteConfigs =
|
|
39
|
+
const historicalRemoteConfigs = res.repository.defaultBranchRef.target.history.edges;
|
|
42
40
|
const latestRemoteConfig = historicalRemoteConfigs[0]?.remoteConfig;
|
|
43
41
|
const skipRemoteConfig = await getSkipRemoteConfigFile(options.cwd, options.skipRemoteConfig, latestRemoteConfig);
|
|
42
|
+
const remoteConfig = skipRemoteConfig
|
|
43
|
+
? {}
|
|
44
|
+
: parseRemoteConfig(latestRemoteConfig);
|
|
44
45
|
return {
|
|
45
|
-
authenticatedUsername: res.viewer.login,
|
|
46
|
-
sourceBranch:
|
|
47
|
-
...
|
|
46
|
+
authenticatedUsername: options.username ?? res.viewer.login,
|
|
47
|
+
sourceBranch: res.repository.defaultBranchRef.name,
|
|
48
|
+
...remoteConfig,
|
|
48
49
|
historicalBranchLabelMappings: skipRemoteConfig
|
|
49
50
|
? []
|
|
50
51
|
: getHistoricalBranchLabelMappings(historicalRemoteConfigs),
|
|
@@ -9,7 +9,7 @@ const getOptionsFromGithub_1 = require("./getOptionsFromGithub");
|
|
|
9
9
|
describe('getOptionsFromGithub', () => {
|
|
10
10
|
let devAccessToken;
|
|
11
11
|
beforeAll(async () => {
|
|
12
|
-
devAccessToken =
|
|
12
|
+
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
13
13
|
jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
|
|
14
14
|
});
|
|
15
15
|
describe('access token', () => {
|
|
@@ -6,33 +6,24 @@ export declare type RemoteConfig = {
|
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
declare type Repository = {
|
|
10
|
-
ref: {
|
|
11
|
-
name: string;
|
|
12
|
-
} | null;
|
|
13
|
-
defaultBranchRef: {
|
|
14
|
-
name: string;
|
|
15
|
-
target: {
|
|
16
|
-
history: {
|
|
17
|
-
edges: Array<{
|
|
18
|
-
remoteConfig: RemoteConfig;
|
|
19
|
-
}>;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
9
|
export interface GithubConfigOptionsResponse {
|
|
25
10
|
viewer: {
|
|
26
11
|
login: string;
|
|
27
12
|
};
|
|
28
13
|
repository: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
14
|
+
illegalBackportBranch: {
|
|
15
|
+
id: string;
|
|
16
|
+
} | null;
|
|
17
|
+
defaultBranchRef: {
|
|
18
|
+
name: string;
|
|
19
|
+
target: {
|
|
20
|
+
history: {
|
|
21
|
+
edges: Array<{
|
|
22
|
+
remoteConfig: RemoteConfig;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
36
28
|
}
|
|
37
|
-
export declare const query = "\n query GithubConfigOptions($repoOwner: String!, $repoName: String!) {\n viewer {\n login\n }\n repository(owner: $repoOwner, name: $repoName) {\n
|
|
38
|
-
export {};
|
|
29
|
+
export declare const query = "\n query GithubConfigOptions($repoOwner: String!, $repoName: String!) {\n viewer {\n login\n }\n repository(owner: $repoOwner, name: $repoName) {\n # check to see if a branch named \"backport\" exists\n illegalBackportBranch: ref(qualifiedName: \"refs/heads/backport\") {\n id\n }\n defaultBranchRef {\n name\n target {\n ... on Commit {\n history(first: 20, path: \".backportrc.json\") {\n edges {\n remoteConfig: node {\n committedDate\n file(path: \".backportrc.json\") {\n ... on TreeEntry {\n object {\n ... on Blob {\n text\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n";
|
|
@@ -7,32 +7,24 @@ exports.query = `
|
|
|
7
7
|
login
|
|
8
8
|
}
|
|
9
9
|
repository(owner: $repoOwner, name: $repoName) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
...Repo
|
|
10
|
+
# check to see if a branch named "backport" exists
|
|
11
|
+
illegalBackportBranch: ref(qualifiedName: "refs/heads/backport") {
|
|
12
|
+
id
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
remoteConfig: node {
|
|
30
|
-
committedDate
|
|
31
|
-
file(path: ".backportrc.json") {
|
|
32
|
-
... on TreeEntry {
|
|
33
|
-
object {
|
|
34
|
-
... on Blob {
|
|
35
|
-
text
|
|
14
|
+
defaultBranchRef {
|
|
15
|
+
name
|
|
16
|
+
target {
|
|
17
|
+
... on Commit {
|
|
18
|
+
history(first: 20, path: ".backportrc.json") {
|
|
19
|
+
edges {
|
|
20
|
+
remoteConfig: node {
|
|
21
|
+
committedDate
|
|
22
|
+
file(path: ".backportrc.json") {
|
|
23
|
+
... on TreeEntry {
|
|
24
|
+
object {
|
|
25
|
+
... on Blob {
|
|
26
|
+
text
|
|
27
|
+
}
|
|
36
28
|
}
|
|
37
29
|
}
|
|
38
30
|
}
|
|
@@ -26,8 +26,8 @@ const getRepoOwnerAndNameFromGitRemotes_1 = require("./getRepoOwnerAndNameFromGi
|
|
|
26
26
|
const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
|
|
27
27
|
describe('fetchRemoteProjectConfig', () => {
|
|
28
28
|
let devAccessToken;
|
|
29
|
-
beforeEach(
|
|
30
|
-
devAccessToken =
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
devAccessToken = (0, getDevAccessToken_1.getDevAccessToken)();
|
|
31
31
|
});
|
|
32
32
|
describe('when the remote is a fork', () => {
|
|
33
33
|
it('retrives the original owner from github', async () => {
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
+
import winston from 'winston';
|
|
2
|
+
export declare let logger: winston.Logger;
|
|
1
3
|
export declare function consoleLog(message: string): void;
|
|
2
|
-
export declare type Logger = typeof logger;
|
|
3
|
-
export declare const logger: {
|
|
4
|
-
error: (message: string, meta?: unknown) => void;
|
|
5
|
-
warn: (message: string, meta?: unknown) => void;
|
|
6
|
-
info: (message: string, meta?: unknown) => void;
|
|
7
|
-
verbose: (message: string, meta?: unknown) => void;
|
|
8
|
-
debug: (message: string, meta?: unknown) => void;
|
|
9
|
-
};
|
|
10
4
|
export declare function updateLogger({ accessToken, verbose, }: {
|
|
11
5
|
accessToken: string;
|
|
12
6
|
verbose?: boolean;
|
|
@@ -15,10 +9,4 @@ export declare function initLogger({ ci, accessToken, logFilePath, }: {
|
|
|
15
9
|
ci?: boolean;
|
|
16
10
|
accessToken?: string;
|
|
17
11
|
logFilePath?: string;
|
|
18
|
-
}):
|
|
19
|
-
error: (message: string, meta?: unknown) => void;
|
|
20
|
-
warn: (message: string, meta?: unknown) => void;
|
|
21
|
-
info: (message: string, meta?: unknown) => void;
|
|
22
|
-
verbose: (message: string, meta?: unknown) => void;
|
|
23
|
-
debug: (message: string, meta?: unknown) => void;
|
|
24
|
-
};
|
|
12
|
+
}): winston.Logger;
|
package/dist/services/logger.js
CHANGED
|
@@ -18,19 +18,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.initLogger = exports.updateLogger = exports.
|
|
26
|
-
const dedent_1 = __importDefault(require("dedent"));
|
|
27
|
-
const lodash_1 = require("lodash");
|
|
28
|
-
const safe_json_stringify_1 = __importDefault(require("safe-json-stringify"));
|
|
22
|
+
exports.initLogger = exports.updateLogger = exports.consoleLog = exports.logger = void 0;
|
|
29
23
|
const winston_1 = __importStar(require("winston"));
|
|
30
24
|
const redact_1 = require("../utils/redact");
|
|
31
25
|
const env_1 = require("./env");
|
|
32
|
-
const { combine } = winston_1.format;
|
|
33
|
-
let winstonInstance;
|
|
34
26
|
// wrapper around console.log
|
|
35
27
|
function consoleLog(message) {
|
|
36
28
|
// eslint-disable-next-line no-console
|
|
@@ -38,29 +30,12 @@ function consoleLog(message) {
|
|
|
38
30
|
//process.stdout.write(message);
|
|
39
31
|
}
|
|
40
32
|
exports.consoleLog = consoleLog;
|
|
41
|
-
exports.logger = {
|
|
42
|
-
error: (message, meta) => {
|
|
43
|
-
winstonInstance.error(message, null, { meta });
|
|
44
|
-
},
|
|
45
|
-
warn: (message, meta) => {
|
|
46
|
-
winstonInstance.warn(message, null, { meta });
|
|
47
|
-
},
|
|
48
|
-
info: (message, meta) => {
|
|
49
|
-
winstonInstance.info(message, null, { meta });
|
|
50
|
-
},
|
|
51
|
-
verbose: (message, meta) => {
|
|
52
|
-
winstonInstance.verbose(message, null, { meta });
|
|
53
|
-
},
|
|
54
|
-
debug: (message, meta) => {
|
|
55
|
-
winstonInstance.debug(message, null, { meta });
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
33
|
let _accessToken;
|
|
59
34
|
function updateLogger({ accessToken, verbose, }) {
|
|
60
35
|
// set access token
|
|
61
36
|
_accessToken = accessToken;
|
|
62
37
|
// set log level
|
|
63
|
-
|
|
38
|
+
exports.logger.level = verbose ? 'debug' : 'info';
|
|
64
39
|
}
|
|
65
40
|
exports.updateLogger = updateLogger;
|
|
66
41
|
function redactAccessToken(str) {
|
|
@@ -75,39 +50,24 @@ function initLogger({ ci, accessToken, logFilePath, }) {
|
|
|
75
50
|
if (accessToken) {
|
|
76
51
|
_accessToken = accessToken;
|
|
77
52
|
}
|
|
78
|
-
|
|
53
|
+
exports.logger = winston_1.default.createLogger({
|
|
54
|
+
format: winston_1.format.combine(winston_1.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
|
|
55
|
+
// Format the metadata object
|
|
56
|
+
winston_1.format.metadata({
|
|
57
|
+
fillExcept: ['message', 'level', 'timestamp', 'label'],
|
|
58
|
+
})),
|
|
79
59
|
transports: ci
|
|
80
60
|
? [fileTransport, new winston_1.default.transports.Console()]
|
|
81
61
|
: [fileTransport],
|
|
82
62
|
});
|
|
83
|
-
// wait exiting until logs have been flushed to disk
|
|
84
|
-
winstonInstance.on('finish', () => {
|
|
85
|
-
process.exit(1);
|
|
86
|
-
});
|
|
87
63
|
return exports.logger;
|
|
88
64
|
}
|
|
89
65
|
exports.initLogger = initLogger;
|
|
90
66
|
function getFileTransport({ logFilePath }) {
|
|
91
67
|
return new winston_1.default.transports.File({
|
|
92
|
-
level: 'debug',
|
|
93
|
-
format: combine(winston_1.format.splat(), winston_1.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston_1.default.format.metadata({
|
|
94
|
-
fillExcept: ['message', 'level', 'timestamp', 'label'],
|
|
95
|
-
}), winston_1.format.printf((info) => {
|
|
96
|
-
// format without metadata
|
|
97
|
-
if (!info.metadata.meta) {
|
|
98
|
-
return redactAccessToken(`${info.timestamp}: ${info.message}`);
|
|
99
|
-
}
|
|
100
|
-
// format when metadata is a string
|
|
101
|
-
if ((0, lodash_1.isString)(info.metadata.meta)) {
|
|
102
|
-
return redactAccessToken(`${info.timestamp}: ${info.message}\n${(0, dedent_1.default)(info.metadata.meta)}\n`);
|
|
103
|
-
}
|
|
104
|
-
if (info.metadata.meta.stack) {
|
|
105
|
-
return redactAccessToken(`${info.timestamp}: ${info.message}\n${info.metadata.meta.stack}\n`);
|
|
106
|
-
}
|
|
107
|
-
// format when metadata is an object
|
|
108
|
-
return redactAccessToken(`${info.timestamp}: ${info.message}\n${(0, safe_json_stringify_1.default)(info.metadata.meta, null, 2)}\n`);
|
|
109
|
-
})),
|
|
110
68
|
filename: (0, env_1.getLogfilePath)({ logFilePath }),
|
|
69
|
+
level: 'debug',
|
|
70
|
+
format: winston_1.format.combine(winston_1.format.json()),
|
|
111
71
|
});
|
|
112
72
|
}
|
|
113
73
|
// log levels:
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
export declare function getDevAccessToken(): string;
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDevAccessToken = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// get accessToken from env vars
|
|
10
|
-
if (accessToken) {
|
|
11
|
-
return accessToken;
|
|
12
|
-
}
|
|
13
|
-
// get credentials from config file
|
|
14
|
-
const accessTokenFile = (0, path_1.resolve)('./src/test/private/accessToken.txt');
|
|
15
|
-
try {
|
|
16
|
-
const accessToken = await (0, promises_1.readFile)(accessTokenFile, {
|
|
17
|
-
encoding: 'utf-8',
|
|
18
|
-
});
|
|
19
|
-
return accessToken.trim();
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
throw new Error(`Missing accessToken in "${accessTokenFile}":\n${e.message}`);
|
|
4
|
+
require("dotenv/config");
|
|
5
|
+
function getDevAccessToken() {
|
|
6
|
+
const accessToken = process.env.ACCESS_TOKEN;
|
|
7
|
+
if (!accessToken) {
|
|
8
|
+
throw new Error('Please create ".env" file containing: `ACCESS_TOKEN="ghp_very_secret"`');
|
|
23
9
|
}
|
|
10
|
+
return accessToken;
|
|
24
11
|
}
|
|
25
12
|
exports.getDevAccessToken = getDevAccessToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "6.
|
|
1
|
+
export declare const PACKAGE_VERSION = "6.3.0-beta-5";
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"branches",
|
|
15
15
|
"branching"
|
|
16
16
|
],
|
|
17
|
-
"version": "6.3.0-beta-
|
|
17
|
+
"version": "6.3.0-beta-6",
|
|
18
18
|
"main": "./dist/entrypoint.module.js",
|
|
19
19
|
"types": "dist/entrypoint.module.d.ts",
|
|
20
20
|
"bin": {
|
|
@@ -66,7 +66,9 @@
|
|
|
66
66
|
"axios": "^0.25.0",
|
|
67
67
|
"dedent": "^0.7.0",
|
|
68
68
|
"del": "^6.0.0",
|
|
69
|
+
"dotenv": "^16.0.0",
|
|
69
70
|
"find-up": "^5.0.0",
|
|
71
|
+
"graphql-tag": "^2.12.6",
|
|
70
72
|
"inquirer": "^8.2.0",
|
|
71
73
|
"lodash": "^4.17.21",
|
|
72
74
|
"make-dir": "^3.1.0",
|
|
@@ -76,7 +78,8 @@
|
|
|
76
78
|
"terminal-link": "^2.1.1",
|
|
77
79
|
"utility-types": "^3.10.0",
|
|
78
80
|
"winston": "^3.5.1",
|
|
79
|
-
"yargs": "^17.3.1"
|
|
81
|
+
"yargs": "^17.3.1",
|
|
82
|
+
"yargs-parser": "^21.0.0"
|
|
80
83
|
},
|
|
81
84
|
"devDependencies": {
|
|
82
85
|
"@types/core-js": "^2.5.5",
|
|
@@ -97,7 +100,6 @@
|
|
|
97
100
|
"eslint-plugin-prettier": "^4.0.0",
|
|
98
101
|
"graphql": "^16.3.0",
|
|
99
102
|
"graphql-config": "^4.1.0",
|
|
100
|
-
"graphql-tag": "^2.12.6",
|
|
101
103
|
"husky": "^7.0.4",
|
|
102
104
|
"jest": "^27.4.7",
|
|
103
105
|
"jest-snapshot-serializer-ansi": "^1.0.0",
|
package/yarn.lock
CHANGED
|
@@ -2015,6 +2015,11 @@ domexception@^2.0.1:
|
|
|
2015
2015
|
dependencies:
|
|
2016
2016
|
webidl-conversions "^5.0.0"
|
|
2017
2017
|
|
|
2018
|
+
dotenv@^16.0.0:
|
|
2019
|
+
version "16.0.0"
|
|
2020
|
+
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.0.tgz#c619001253be89ebb638d027b609c75c26e47411"
|
|
2021
|
+
integrity sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==
|
|
2022
|
+
|
|
2018
2023
|
dset@^3.1.0:
|
|
2019
2024
|
version "3.1.1"
|
|
2020
2025
|
resolved "https://registry.yarnpkg.com/dset/-/dset-3.1.1.tgz#07de5af7a8d03eab337ad1a8ba77fe17bba61a8c"
|