-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (36 loc) · 902 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
30
31
32
33
34
35
36
37
38
39
40
41
/**
Simple command line pull request processor
*/
"use strict";
const GitHubApi = require("github");
const program = require("commander");
const main = require('./pull_request');
const config = require('./config');
const github = new GitHubApi({
version: "3.0.0",
headers: {
"user-agent": "80x40-client"
}
});
program
.version('0.0.0')
.option('--number <number>', 'Pull request to process')
.option('--token <token>', 'Github user token')
.parse(process.argv);
github.authenticate({
type: "oauth",
token: program.token
});
const logResult = (err) => {
if (err) {
console.error("ERROR", err);
} else {
console.log("OK");
}
};
if (program.number) {
main.handlePullRequest(github, config.user, config.repo, program.number,
logResult);
} else {
main.handleAllPullRequests(github, config.user, config.repo, logResult);
}