forked from jlord/git-it
-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify.js
31 lines (26 loc) · 922 Bytes
/
verify.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
#!/usr/bin/env node
var request = require('request')
var exec = require('child_process').exec
// var url = "http://localhost:5563/collab?username="
var url = 'http://reporobot.jlord.us/collab?username='
exec('git config user.username', function(err, stdout, stdrr) {
var username = stdout.trim()
collaborating(username)
})
// check that they've added RR as a collaborator
function collaborating(username) {
request(url + username, {json: true}, function (error, response, body) {
if (error) console.log(error)
if (!error) {
if (response.statusCode == 200) {
if (body.collab = true) console.log("Reporobot has been added!")
else console.log("Reporobot doesn't have access to the fork")
if (body.error) console.log(body)
}
else {
console.log("Unexpected HTTP status code accessing Reporobot server: " +
response.statusCode)
}
}
})
}