mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
fix: use better tag endpoint for github datasource
This commit is contained in:
parent
45d0dcf492
commit
dc143eb4e5
2 changed files with 6 additions and 9 deletions
|
@ -25,11 +25,8 @@ async function getDependency(purl) {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// tag
|
// tag
|
||||||
const url = `repos/${repo}/git/refs/tags?per_page=100`;
|
const url = `repos/${repo}/tags?per_page=100`;
|
||||||
const tagPrefix = 'refs/tags/';
|
versions = (await ghGot(url, { paginate: true })).body.map(o => o.name);
|
||||||
versions = (await ghGot(url, { paginate: true })).body
|
|
||||||
.filter(o => o.ref && o.ref.startsWith(tagPrefix))
|
|
||||||
.map(o => o.ref.replace(tagPrefix, ''));
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|
|
@ -8,10 +8,10 @@ describe('datasource/github', () => {
|
||||||
describe('getDependency', () => {
|
describe('getDependency', () => {
|
||||||
it('returns cleaned tags', async () => {
|
it('returns cleaned tags', async () => {
|
||||||
const body = [
|
const body = [
|
||||||
{ ref: 'refs/tags/a' },
|
{ name: 'a' },
|
||||||
{ ref: 'refs/tags/v' },
|
{ name: 'v' },
|
||||||
{ ref: 'refs/tags/1.0.0' },
|
{ name: '1.0.0' },
|
||||||
{ ref: 'refs/tags/v1.1.0' },
|
{ name: 'v1.1.0' },
|
||||||
];
|
];
|
||||||
ghGot.mockReturnValueOnce({ headers: {}, body });
|
ghGot.mockReturnValueOnce({ headers: {}, body });
|
||||||
const res = await datasource.getDependency(
|
const res = await datasource.getDependency(
|
||||||
|
|
Loading…
Reference in a new issue