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 {
|
||||
// tag
|
||||
const url = `repos/${repo}/git/refs/tags?per_page=100`;
|
||||
const tagPrefix = 'refs/tags/';
|
||||
versions = (await ghGot(url, { paginate: true })).body
|
||||
.filter(o => o.ref && o.ref.startsWith(tagPrefix))
|
||||
.map(o => o.ref.replace(tagPrefix, ''));
|
||||
const url = `repos/${repo}/tags?per_page=100`;
|
||||
versions = (await ghGot(url, { paginate: true })).body.map(o => o.name);
|
||||
}
|
||||
} catch (err) {
|
||||
logger.info(
|
||||
|
|
|
@ -8,10 +8,10 @@ describe('datasource/github', () => {
|
|||
describe('getDependency', () => {
|
||||
it('returns cleaned tags', async () => {
|
||||
const body = [
|
||||
{ ref: 'refs/tags/a' },
|
||||
{ ref: 'refs/tags/v' },
|
||||
{ ref: 'refs/tags/1.0.0' },
|
||||
{ ref: 'refs/tags/v1.1.0' },
|
||||
{ name: 'a' },
|
||||
{ name: 'v' },
|
||||
{ name: '1.0.0' },
|
||||
{ name: 'v1.1.0' },
|
||||
];
|
||||
ghGot.mockReturnValueOnce({ headers: {}, body });
|
||||
const res = await datasource.getDependency(
|
||||
|
|
Loading…
Reference in a new issue