X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=_common%2Fgithub.js;h=aa98074ccfc9ed2fc8af7d5e6c13e4f75badded7;hb=8fa367de83c4ce9e8808e78735a58834ebcc9e74;hp=442b16b0b82534fc7aea8399e3718d388f8641c5;hpb=5fabdc4760c2f6448b4ad36a7838b45f2d7840ab;p=webi-installers%2F.git diff --git a/_common/github.js b/_common/github.js index 442b16b..aa98074 100644 --- a/_common/github.js +++ b/_common/github.js @@ -1,5 +1,7 @@ 'use strict'; +require('dotenv').config(); + /** * Gets the releases for 'ripgrep'. This function could be trimmed down and made * for use with any github release. @@ -21,10 +23,20 @@ function getAllReleases( if (!repo) { return Promise.reject('missing repo name'); } - return request({ + + var req = { url: `${baseurl}/repos/${owner}/${repo}/releases`, json: true - }).then((resp) => { + }; + // TODO I really don't like global config, find a way to do better + if (process.env.GITHUB_USERNAME) { + req.auth = { + user: process.env.GITHUB_USERNAME, + pass: process.env.GITHUB_TOKEN + }; + } + + return request(req).then((resp) => { const gHubResp = resp.body; const all = { releases: [],