Skip to content
Snippets Groups Projects
Commit 373b9d8a authored by Rhys Arkins's avatar Rhys Arkins
Browse files

refactor: simplify githubBaseURL/opts

parent a07592a1
No related branches found
No related tags found
No related merge requests found
......@@ -26,15 +26,13 @@ async function getChangeLogJSON(args) {
let token;
let endpoint;
let gheBaseURL;
const opts = {
githubBaseURL: 'https://github.com/',
};
let githubBaseURL = 'https://github.com/';
if (process.env.GITHUB_ENDPOINT) {
const parsedEndpoint = url.parse(process.env.GITHUB_ENDPOINT);
gheBaseURL = `${parsedEndpoint.protocol}//${parsedEndpoint.hostname}/`;
if (repositoryUrl.startsWith(gheBaseURL)) {
opts.githubBaseURL = gheBaseURL;
githubBaseURL = gheBaseURL;
} else {
// Switch tokens
token = process.env.GITHUB_TOKEN;
......@@ -48,7 +46,7 @@ async function getChangeLogJSON(args) {
if (!res) {
res = await sourceGithub.getChangeLogJSON({
...args,
...opts,
githubBaseURL,
});
await sourceCache.setChangeLogJSON(args, res);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment