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 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();
}); });
}; };

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

Loading…
Cancel
Save