-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·29 lines (24 loc) · 947 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env node
const assert = require('assert');
const { createGitClient } = require('./lib/clients/git');
const createOutputFormatter = require('./lib/output');
const run = require('./lib/run');
const { getCLIArgs, getRepositoryConfigFromArgs } = require('./lib/utils');
const cliArgs = getCLIArgs();
const repositoryConfig = getRepositoryConfigFromArgs(cliArgs);
const getFormattedResult = createOutputFormatter(cliArgs.output);
assert.ok(
process.env.GITHUB_AUTH_TOKEN,
'GITHUB_AUTH_TOKEN environment variable is not set. Please make sure you set a valid Github personal access token for GITHUB_AUTH_TOKEN environment variable',
);
const gitClient = createGitClient({
accessToken: process.env.GITHUB_AUTH_TOKEN,
repositoryConfig,
});
(async () => {
const { success, results } = await run({ gitClient, cliArgs });
console.log(getFormattedResult(repositoryConfig, results));
if (!success) {
process.exit(1);
}
})();