summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/publish.yml2
-rw-r--r--script/changelog.ts30
2 files changed, 23 insertions, 9 deletions
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index f207eb3ac..fc9181bc5 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -55,7 +55,7 @@ jobs:
- name: Install OpenCode
if: inputs.bump || inputs.version
- run: bun i -g [email protected]
+ run: bun i -g [email protected]
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
diff --git a/script/changelog.ts b/script/changelog.ts
index 184979a1d..8e006382b 100644
--- a/script/changelog.ts
+++ b/script/changelog.ts
@@ -185,23 +185,37 @@ export async function generateChangelog(previous: string, current: string): Prom
const commits = commitsWithMeta.join("\n")
+ if (!commits.trim()) {
+ console.error("No commits found to generate changelog")
+ }
+
// Generate changelog via LLM
// different port to not conflict with dev running opencode
- const opencode = await createOpencode({ port: 8192 })
let raw: string | undefined
try {
- const session = await opencode.client.session.create()
- raw = await opencode.client.session
- .prompt({
- path: { id: session.data!.id },
+ const opencode = await createOpencode({ port: 8192 })
+ try {
+ const session = await opencode.client.session.create()
+ if (!session.data?.id) {
+ console.error("Failed to create session:", session)
+ throw new Error("Failed to create session")
+ }
+ const response = await opencode.client.session.prompt({
+ path: { id: session.data.id },
body: {
model: { providerID: "opencode", modelID: MODEL },
parts: [{ type: "text", text: buildPrompt(previous, commits) }],
},
})
- .then((x) => x.data?.parts?.find((y) => y.type === "text")?.text)
- } finally {
- opencode.server.close()
+ if (!response.data?.parts) {
+ console.error("Empty response from LLM:", response)
+ }
+ raw = response.data?.parts?.find((y) => y.type === "text")?.text
+ } finally {
+ opencode.server.close()
+ }
+ } catch (err) {
+ console.error("Failed to generate changelog via LLM:", err)
}
const notes = parseChangelog(raw ?? "")