diff options
| author | Dax Raad <[email protected]> | 2026-01-30 00:43:36 -0500 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2026-01-30 00:43:36 -0500 |
| commit | 5bef8e316ad99e899afc6caf9f5a3056e68efa04 (patch) | |
| tree | 610875090637418b78d7a41ddd1dc343e2fd40b6 /script/changelog.ts | |
| parent | 08f11f4da6f16dd02024fba0914e13af7ba784c4 (diff) | |
| download | opencode-5bef8e316ad99e899afc6caf9f5a3056e68efa04.tar.gz opencode-5bef8e316ad99e899afc6caf9f5a3056e68efa04.zip | |
ci
Diffstat (limited to 'script/changelog.ts')
| -rwxr-xr-x | script/changelog.ts | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/script/changelog.ts b/script/changelog.ts index ace579ee4..0c8d65ba1 100755 --- a/script/changelog.ts +++ b/script/changelog.ts @@ -18,13 +18,29 @@ export const team = [ "R44VC0RP", ] -export async function getLatestRelease() { - return fetch("https://api.github.com/repos/anomalyco/opencode/releases/latest") - .then((res) => { - if (!res.ok) throw new Error(res.statusText) - return res.json() - }) - .then((data: any) => data.tag_name.replace(/^v/, "")) +type Release = { + tag_name: string + draft: boolean + prerelease: boolean +} + +export async function getLatestRelease(skip?: string) { + const data = await fetch("https://api.github.com/repos/anomalyco/opencode/releases?per_page=100").then((res) => { + if (!res.ok) throw new Error(res.statusText) + return res.json() + }) + + const releases = data as Release[] + const target = skip?.replace(/^v/, "") + + for (const release of releases) { + if (release.draft) continue + const tag = release.tag_name.replace(/^v/, "") + if (target && tag === target) continue + return tag + } + + throw new Error("No releases found") } type Commit = { |
