-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.js
34 lines (26 loc) · 977 Bytes
/
utils.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
34
const rp = require('request-promise');
module.exports = {
getReleaseBody :async (repo,tag,token)=>{
return new Promise(function (resolve,reject){
var options = {
uri: `https://api.github.com/repos/${repo}/releases/tags/${tag}`,
headers: {
'Accept': 'application/vnd.github.v3+json',
'user-agent': 'node.js',
'Authorization': token
},
json: true // Automatically parses the JSON string in the response
};
rp(options)
.then(function (repos) {
//console.log('result', repos);
resolve(repos)
})
.catch(function (err) {
// API call failed...
console.log('something went wrong',err)
reject(err)
});
})
},
}