Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(galaxy-collection): return sourceUrl of highest_version in getReleases() #25769

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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