|
|
@ -3,31 +3,24 @@ |
|
|
|
var fs = require('fs'); |
|
|
|
var fs = require('fs'); |
|
|
|
var fse = require('fs-extra'); |
|
|
|
var fse = require('fs-extra'); |
|
|
|
var async = require('async'); |
|
|
|
var async = require('async'); |
|
|
|
var request = require('request'); |
|
|
|
|
|
|
|
var gitLoader = require('./git-loader'); |
|
|
|
var gitLoader = require('./git-loader'); |
|
|
|
var processor = require('./task-processor'); |
|
|
|
var processor = require('./task-processor'); |
|
|
|
var mailSender = require('./mail-sender'); |
|
|
|
var mailSender = require('./mail-sender'); |
|
|
|
var settings = require('../settings'); |
|
|
|
var settings = require('../settings'); |
|
|
|
|
|
|
|
|
|
|
|
var notifyStatus = function (options, callback) { |
|
|
|
var notifyStatus = function (options, callback) { |
|
|
|
var url = "https://github.pos/api/v3/repos/" + options.owner + "/" + options.reponame + "/statuses/" + options.hash; |
|
|
|
settings.createGithub(options.owner).statuses.create({ |
|
|
|
request.post(url, { |
|
|
|
user: options.owner, |
|
|
|
auth: settings.getGithubAuth(options.owner), |
|
|
|
repo: options.reponame, |
|
|
|
json: { |
|
|
|
sha: options.hash, |
|
|
|
state: options.state, |
|
|
|
state: options.state, |
|
|
|
target_url: "https://mbs.pos/status/" + options.owner + "/" + options.reponame + "/" + options.hash, |
|
|
|
target_url: "https://mbs.pos/status/" + options.owner + "/" + options.reponame + "/" + options.hash, |
|
|
|
description: ((options.description || "") + "").substr(0, 140) |
|
|
|
description: ((options.description || "") + "").substr(0, 140) |
|
|
|
} |
|
|
|
}, function (err, result) { |
|
|
|
}, function (err, response, body) { |
|
|
|
|
|
|
|
if (err) { |
|
|
|
if (err) { |
|
|
|
console.log("Error: " + err); |
|
|
|
console.log("Error: " + err); |
|
|
|
return callback(err); |
|
|
|
return callback(err); |
|
|
|
} |
|
|
|
} |
|
|
|
console.log("Status code: " + response.statusCode); |
|
|
|
|
|
|
|
console.log(body); |
|
|
|
|
|
|
|
if (response.statusCode !== 200) { |
|
|
|
|
|
|
|
return callback(body); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return callback(); |
|
|
|
return callback(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|