Skip to content

Commit

Permalink
Add release notes to firmware list endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
thebentern committed Mar 7, 2024
1 parent dae9d5a commit e984377
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/routes/firmware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export const FirmwareRoutes = () => {
} else {
const releases = (
await GitHub.deviceOctokit.rest.repos.listReleases(
GitHub.DeviceRequestOptions,
GitHub.DeviceRequestOptions
)
).data
.filter((r) => Number.parseInt(r.tag_name.substring(1, 2)) > 1)
.filter((r) => !r.name?.includes("(Revoked)"));
const prs = await GitHub.deviceOctokit.rest.pulls.list(
GitHub.DeviceRequestOptions,
GitHub.DeviceRequestOptions
);

const prArtifacts = await Promise.all(
Expand All @@ -33,12 +33,12 @@ export const FirmwareRoutes = () => {
const comments = await GitHub.deviceOctokit.request(pr.comments_url);
const artifactComments = comments.data.filter(
(comment: { user: { login: string } }) =>
comment.user.login === "github-actions[bot]",
comment.user.login === "github-actions[bot]"
);

if (artifactComments.length > 0) {
const matches = GitHub.FirmwareLinkRegex.exec(
artifactComments[0].body,
artifactComments[0].body
);
if (matches && matches.length > 0) {
zip_url = matches[1];
Expand All @@ -51,7 +51,7 @@ export const FirmwareRoutes = () => {
page_url: pr.html_url,
zip_url: zip_url,
};
}),
})
);

const firmwareReleases: FirmwareReleases = {
Expand All @@ -64,8 +64,9 @@ export const FirmwareRoutes = () => {
title: release.name,
page_url: release.html_url,
zip_url: release.assets.find((asset) =>
asset.name.startsWith("firmware-"),
asset.name.startsWith("firmware-")
)?.browser_download_url,
release_notes: release.body,
};
}),
alpha: releases
Expand All @@ -76,8 +77,9 @@ export const FirmwareRoutes = () => {
title: release.name,
page_url: release.html_url,
zip_url: release.assets.find((asset) =>
asset.name.startsWith("firmware-"),
asset.name.startsWith("firmware-")
)?.browser_download_url,
release_notes: release.body,
};
}),
},
Expand Down

0 comments on commit e984377

Please sign in to comment.