Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:

- name: Generate OpenCode release diff summary
if: ${{ steps.release.outputs.release_created == 'true' }}
continue-on-error: true
env:
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
OPENCODE_MODEL: ${{ vars.OPENCODE_MODEL }}
Expand All @@ -56,14 +55,13 @@ jobs:

- name: Append OpenCode summary to GitHub release
if: ${{ steps.release.outputs.release_created == 'true' }}
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG_NAME: ${{ steps.release.outputs.tag_name }}
run: |
if [ ! -s opencode-release-summary.md ]; then
echo "No OpenCode release summary was generated."
exit 0
exit 1
fi

gh release view "$RELEASE_TAG_NAME" --json body --jq '.body // ""' > release-notes.md
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ Rendering coverage follows the installed `milsymbol` package. The curated semant

Image-based reverse lookup is intentionally deferred.

## Changelog

Release history is maintained in [`CHANGELOG.md`](./CHANGELOG.md) and GitHub Releases. The npm package includes `CHANGELOG.md` so published artifacts carry the release history.

## Release Automation

Releases are managed by Release Please. Commits merged to `main` should use Conventional Commit prefixes:
Expand All @@ -95,4 +99,4 @@ Npm publishing uses trusted publishing with GitHub Actions OIDC. Configure the p

No long-lived `NPM_TOKEN` is required for the release workflow.

If `OPENCODE_API_KEY` is configured as a GitHub Actions secret, the release workflow also asks OpenCode to summarize the diff between the new release tag and the previous release tag, then appends that summary to the GitHub release notes. Set the optional repository variable `OPENCODE_MODEL` to override the default `opencode/kimi-k2` model.
The release workflow requires `OPENCODE_API_KEY` as a GitHub Actions secret so OpenCode can summarize the diff between the new release tag and the previous release tag, then append that summary to the GitHub release notes. If summary generation or release-note appending fails, publishing fails. Set the optional repository variable `OPENCODE_MODEL` to override the default `opencode/kimi-k2` model.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
},
"files": [
"dist",
"README.md"
"README.md",
"CHANGELOG.md"
],
"repository": {
"type": "git",
Expand Down
14 changes: 7 additions & 7 deletions scripts/summarize-release-diff.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ const outputPath = "opencode-release-summary.md";
const maxPatchBytes = 120_000;

if (!tagName) {
console.log("No release tag was provided; skipping OpenCode release summary.");
process.exit(0);
console.error("No release tag was provided; cannot generate OpenCode release summary.");
process.exit(1);
}

if (!openCodeApiKey) {
console.log("OPENCODE_API_KEY is not configured; skipping OpenCode release summary.");
process.exit(0);
console.error("OPENCODE_API_KEY is not configured; cannot generate OpenCode release summary.");
process.exit(1);
}

/**
Expand Down Expand Up @@ -85,7 +85,7 @@ const prompt = [

const result = spawnSync(
"npx",
["-y", "opencode-ai@1.17.9", "run", "--pure", "--model", model, "--file", contextPath, prompt],
["-y", "opencode-ai@1.17.9", "run", prompt, "--pure", "--model", model, "--file", contextPath],
{
encoding: "utf8",
env: process.env,
Expand All @@ -106,8 +106,8 @@ if (result.status !== 0) {

const summary = result.stdout.trim();
if (!summary) {
console.log("OpenCode returned an empty summary.");
process.exit(0);
console.error("OpenCode returned an empty summary.");
process.exit(1);
}

writeFileSync(outputPath, `${summary}\n`);
Expand Down
Loading