fix(ghe): use full path for github datasource

This prevents accidentally querying GHE for things such as Node.js tags.

Closes #2518
This commit is contained in:
Rhys Arkins 2018-09-13 05:50:16 +02:00
parent e66ededcfd
commit 6f0ceaecc5

View file

@ -17,7 +17,7 @@ async function getPreset(pkgName, presetName = 'default') {
} }
let res; let res;
try { try {
const url = `repos/${pkgName}/contents/renovate.json`; const url = `https://api.github.com/repos/${pkgName}/contents/renovate.json`;
res = Buffer.from((await ghGot(url)).body.content, 'base64').toString(); res = Buffer.from((await ghGot(url)).body.content, 'base64').toString();
} catch (err) { } catch (err) {
logger.debug('Failed to retrieve renovate.json from repo'); logger.debug('Failed to retrieve renovate.json from repo');
@ -50,13 +50,13 @@ async function getPkgReleases(purl, config) {
} }
try { try {
if (options.ref === 'release') { if (options.ref === 'release') {
const url = `repos/${repo}/releases?per_page=100`; const url = `https://api.github.com/repos/${repo}/releases?per_page=100`;
versions = (await ghGot(url, { paginate: true })).body.map( versions = (await ghGot(url, { paginate: true })).body.map(
o => o.tag_name o => o.tag_name
); );
} else { } else {
// tag // tag
const url = `repos/${repo}/tags?per_page=100`; const url = `https://api.github.com/repos/${repo}/tags?per_page=100`;
versions = (await ghGot(url, { versions = (await ghGot(url, {
cache: process.env.RENOVATE_SKIP_CACHE ? undefined : map, cache: process.env.RENOVATE_SKIP_CACHE ? undefined : map,
paginate: true, paginate: true,