Skip to content

Commit

Permalink
Merge pull request #22 from meshtastic/add-release-notes
Browse files Browse the repository at this point in the history
Add release notes to firmware list endpoint
  • Loading branch information
thebentern authored Mar 7, 2024
2 parents 4ddfc9d + e984377 commit 96ad949
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,

Check warning on line 51 in src/routes/firmware.ts

View workflow job for this annotation

GitHub Actions / quality

This object property name should be in camelCase.
zip_url: zip_url,

Check warning on line 52 in src/routes/firmware.ts

View workflow job for this annotation

GitHub Actions / quality

This object property name should be in camelCase.
};
}),
})
);

const firmwareReleases: FirmwareReleases = {
Expand All @@ -64,8 +64,9 @@ export const FirmwareRoutes = () => {
title: release.name,
page_url: release.html_url,

Check warning on line 65 in src/routes/firmware.ts

View workflow job for this annotation

GitHub Actions / quality

This object property name should be in camelCase.
zip_url: release.assets.find((asset) =>

Check warning on line 66 in src/routes/firmware.ts

View workflow job for this annotation

GitHub Actions / quality

This object property name should be in camelCase.
asset.name.startsWith("firmware-"),
asset.name.startsWith("firmware-")
)?.browser_download_url,
release_notes: release.body,

Check warning on line 69 in src/routes/firmware.ts

View workflow job for this annotation

GitHub Actions / quality

This object property name should be in camelCase.
};
}),
alpha: releases
Expand All @@ -76,8 +77,9 @@ export const FirmwareRoutes = () => {
title: release.name,
page_url: release.html_url,

Check warning on line 78 in src/routes/firmware.ts

View workflow job for this annotation

GitHub Actions / quality

This object property name should be in camelCase.
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 96ad949

Please sign in to comment.