Skip to content

Commit

Permalink
Merging into master from: test-bot-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonolmstead33 authored Dec 14, 2016
2 parents 37ec9e8 + ae18ee6 commit 9759741
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 10 deletions.
5 changes: 1 addition & 4 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@ build:
commit:
image: node:6
commands:
- npm install
- npm run commit
when:
branch:
- master
- test-*
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
console.log("Hello Drone")

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"test": "mocha",
"commit" : "node src/github.js"
"commit": "node index.js"
},
"repository": {
"type": "git",
Expand All @@ -18,9 +18,9 @@
},
"homepage": "https://github.com/Nordstrom/build-bot#readme",
"xo": {
"esnext": true,
"semicolon": false,
"space": 4
"esnext": true,
"semicolon": false,
"space": 4
},
"devDependencies": {
"mocha": "^3.2.0",
Expand All @@ -30,6 +30,9 @@
"dependencies": {
"aws-sdk": "^2.7.13",
"bluebird": "^3.4.6",
"https-proxy-agent": "^1.0.0",
"request": "^2.79.0",
"request-promise": "^4.1.1",
"slack": "^8.1.2"
}
}
67 changes: 65 additions & 2 deletions src/github.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,73 @@
var rp = require('request-promise'),
HttpsProxyAgent = require('https-proxy-agent');;

const BASE_URL = "https://api.github.com/repos/";
const AUTH_URL = "https://github.com/login/oauth/authorize";
const OWNER = "Nordstrom/";
const REPO = "build-bot/";
const TOKEN = "access_token=0fe2c88a900ed9d2e13eaeb375176ccb3d4636d8";
const CLIENT_ID_AND_SECRET = "client_id=9536727b9f252ceb5e03&client_secret=8ebef8e5e15d50472b3656d70bd2cec5ad887e0f";
const BASIC_AUTH = "Basic amFzb25vbG1zdGVhZDMzOkJAc2ViYWxsMzM=";

var Github = {
commit : function(){
console.log("Committing...")
},
authorizeAsync : function(){
var params = {
method : "GET",
uri : AUTH_URL + "?client_id=" + CLIENT_ID
};

if (!!process.env.LOCAL){
params.agent = new HttpsProxyAgent("http://webproxysea.nordstrom.net:8181");
}

return rp(params)
.then(function(data){
console.log(data);
})
},
mergeAsync : function(base, head, message){
if (!base || !head || !message){
return Promise.reject("Invalid request")
}

var params = {
uri : BASE_URL + OWNER + REPO + "merges",
method : "POST",
json : true,
headers : {
"Accept": "application/json",
"Content-Type": "application/json",
"User-Agent" : "Hackathon-Local-Dev",
"Authorization" : BASIC_AUTH
},
body : {
"base": base,
"head": head,
"commit_message": message
}
};

if (!!process.env.LOCAL){
params.agent = new HttpsProxyAgent("http://webproxysea.nordstrom.net:8181");
}

return rp(params)
.then(function(data){
console.log("DATA")
console.log(data);
})
.catch(function(err){
console.log("ERR")
console.log(err.message);
console.log(err.response.headers);
})
}
};

module.exports = Github;

console.log(Github.commit());
console.log("done again");
//Github.authorizeAsync()
Github.mergeAsync("test-bot-branch", "master", "First merge of bot branches")

0 comments on commit 9759741

Please sign in to comment.