Skip to content

Commit

Permalink
fix(galaxy-collection): return sourceUrl of highest_version in `g…
Browse files Browse the repository at this point in the history
…etReleases()` (#25769)
  • Loading branch information
Shegox committed Nov 14, 2023
1 parent 55a2619 commit 786f4e8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Expand Up @@ -5,8 +5,8 @@
"deprecated": false,
"versions_url": "/api/v3/plugin/ansible/content/published/collections/index/community/kubernetes/versions/",
"highest_version": {
"href": "/api/v3/plugin/ansible/content/published/collections/index/community/kubernetes/versions/2.0.1/",
"version": "2.0.1"
"href": "/api/v3/plugin/ansible/content/published/collections/index/community/kubernetes/versions/1.2.1/",
"version": "1.2.1"
},
"created_at": "2023-05-08T20:27:28.514620Z",
"updated_at": "2023-10-15T22:54:12.688681Z",
Expand Down
Expand Up @@ -29,5 +29,6 @@ exports[`modules/datasource/galaxy-collection/index getReleases processes real d
"version": "1.2.1",
},
],
"sourceUrl": "https://github.com/ansible-collections/community.kubernetes",
}
`;
6 changes: 6 additions & 0 deletions lib/modules/datasource/galaxy-collection/index.ts
Expand Up @@ -86,8 +86,14 @@ export class GalaxyCollectionDatasource extends Datasource {
const filteredReleases = enrichedReleases.filter(is.truthy);
// extract base information which are only provided on the release from the newest release

// Find the source URL of the highest version release
const sourceUrlOfHighestRelease = enrichedReleases.find(
(release) => baseProject.highest_version.version === release.version,
)?.sourceUrl;

return {
releases: filteredReleases,
sourceUrl: sourceUrlOfHighestRelease,
};
}

Expand Down

0 comments on commit 786f4e8

Please sign in to comment.