node-github used to create github statuses

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 11 years ago
parent 4184f54006
commit ff0f0e7a31
  1. 23
      BuildServer/lib/builder.js
  2. 2
      BuildServer/package.json

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

@ -11,7 +11,7 @@
"async": "~0.2.9",
"fs-extra": "~0.8.1",
"git-node": "~0.1.1",
"request": "~2.27.0",
"github": "~0.2.0",
"glob": "~3.2.7",
"nodemailer": "~0.6.0",
"mustache": "~0.8.1",

Loading…
Cancel
Save