-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathissue.js
More file actions
38 lines (35 loc) · 911 Bytes
/
issue.js
File metadata and controls
38 lines (35 loc) · 911 Bytes
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
const config = require("./config");
const request = require("request");
const createIssue = function(issue) {
const options = {
method: "POST",
url:
"https://api.github.com/repos/" +
config.username +
"/" +
config.toRepo +
"/issues",
headers: {
"Cache-Control": "no-cache",
"User-Agent": "GitHubTools",
Authorization: "token " + config.token,
"Content-Type": "application/json"
},
body: issue,
json: true
};
request(options, function(error, response, body) {
if (error) throw new Error(error);
if (response.statusCode === 201) {
console.log("Created New Issue " + body.id);
} else {
console.log(
"Error Sending Issue " +
(issue.id === undefined ? issue.title : issue.id) +
" | Error: " +
response.statusCode
);
}
});
};
exports.create = createIssue;