-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstaticFunctions.js
33 lines (30 loc) · 1.6 KB
/
staticFunctions.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
32
33
const fetch = require("node-fetch");
global.Headers = fetch.Headers;
function getRequestHeaders(){
let h = new Headers();
let auth = 'Bearer ' + process.env.gh_token;
h.append('Authorization', auth);
return h;
}
exports.getRequestHeaders = getRequestHeaders;
function getValuesFromPayload(payload) {
var vm = {
action: payload.action != undefined ? payload.action : "",
env : {
organization: process.env.ado_organization != undefined ? process.env.ado_organization : "",
orgurl: process.env.ado_organization != undefined ? "https://dev.azure.com/" + process.env.ado_organization : "",
ado_token: process.env.ado_token != undefined ? process.env.ado_token : "",
project: process.env.ado_project != undefined ? process.env.ado_project : "",
ghrepo_owner: process.env.gh_repo_owner != undefined ? process.env.gh_repo_owner :"",
ghrepo: process.env.gh_repo != undefined ? process.env.gh_repo :"",
pull_number: process.env.pull_number != undefined ? process.env.pull_number :"",
closedstate: process.env.closedstate != undefined ? process.env.closedstate :"",
propenstate: process.env.propenstate != undefined ? process.env.propenstate :"",
inprogressstate: process.env.inprogressstate != undefined ? process.env.inprogressstate :"",
branch_name: process.env.branch_name != undefined ? process.env.branch_name :"",
gh_token: process.env.gh_token != undefined ? process.env.gh_token :""
}
}
return vm;
}
exports.getValuesFromPayload = getValuesFromPayload;