mirror of
https://github.com/RamonGebben/mergify.git
synced 2026-03-10 08:51:18 +00:00
25 lines
428 B
JavaScript
25 lines
428 B
JavaScript
const fetch = require('node-fetch');
|
|
const { readConfig } = require('../readConfig');
|
|
|
|
async function doFetch(path) {
|
|
const config = await readConfig();
|
|
|
|
const {
|
|
privateToken,
|
|
domain
|
|
} = config;
|
|
|
|
const fetchOptions = {
|
|
headers: {
|
|
'PRIVATE-TOKEN': privateToken
|
|
}
|
|
};
|
|
|
|
return fetch(`https://${domain}/api/v4/${path}`, fetchOptions)
|
|
.then(res => res.json());
|
|
}
|
|
|
|
module.exports = {
|
|
doFetch
|
|
};
|