Skip to content

Commit

Permalink
fix: exclude prereleases from latest release api
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffen911 committed Nov 28, 2024
1 parent ab86046 commit c4ae400
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pages/api/latest-releases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ const getLatestReleases = async (): Promise<ApiResponse[]> => {
}

const langfuseReleases = await Promise.all(
responses.map(async (response, index) => {
responses.flatMap(async (response, index) => {
const data = await response.json();
const latestRelease = data[0];
return {
const latestRelease = data.find((release) => !release.prerelease);
if (!latestRelease) {
return [];
}
return [{
repo: REPOS[index],
latestRelease: latestRelease ? latestRelease.tag_name : undefined,
publishedAt: latestRelease ? latestRelease.published_at : undefined,
url: latestRelease ? latestRelease.html_url : undefined,
};
}];
})
);

Expand Down

0 comments on commit c4ae400

Please sign in to comment.