[PR #8975] [MERGED] ci: add release notes pipeline with AI rewriting #25239

Closed
opened 2026-04-15 22:46:57 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8975
Author: @gustavovalverde
Created: 4/5/2026
Status: Merged
Merged: 4/6/2026
Merged by: @gustavovalverde

Base: mainHead: feat/release-notes-pipeline


📝 Commits (10+)

  • 9663e7e ci: add release notes pipeline with AI rewriting
  • 522d230 fix(ci): prevent duplicate prerelease entries and fix stable preview fallback
  • 4c643a8 fix(ci): add id-token permission for claude-code-action in preview-notes
  • 961694f fix(ci): pass github_token to claude-code-action for workflow validation
  • ad56688 fix(ci): index all changeset files, not just pr-/commit- patterns
  • 422f86a fix(ci): write raw changelog in repo directory for claude-code-action access
  • cfc3356 fix(ci): allow Bash(gh:*) and increase max-turns for AI rewrite step
  • 06227d5 fix(ci): increase max-turns to 15, limit diff inspections to most unclear entries
  • b15d7ed fix(ci): rewrite AI prompt for consistent tense, code formatting, and user focus
  • ce71acc fix(ci): add flow-on effects guidance from opencode prompt patterns

📊 Changes

6 files changed (+1295 additions, -76 deletions)

View changed files

.github/prompts/release-notes-rewrite.md (+71 -0)
📝 .github/scripts/auto-changeset.ts (+2 -74)
.github/scripts/lib/github.ts (+36 -0)
.github/scripts/lib/pr-analyzer.ts (+246 -0)
.github/scripts/release-notes.ts (+714 -0)
📝 .github/workflows/release.yml (+226 -2)

📄 Description

Summary

The changesets/action creates one GitHub Release per published package (20 releases for a lockstep monorepo), each with wrong attribution because all changeset files share a single batch commit. This PR replaces that with a single consolidated release produced by a two-stage pipeline: deterministic data extraction followed by AI rewriting.

Two-Stage Pipeline

The release notes flow through two stages that serve different purposes but produce a single output.

Stage 1 (release-notes.ts) is deterministic. It uses git history as the ground truth (not changesets alone, which can miss PRs merged without changeset files), resolves actual PR authors via gh pr view, classifies each entry into a domain using the same scope and file-path mappings that drive actions/labeler, and handles the cherry-pick history gap between main and next through PR-number deduplication.

Stage 2 (claude-code-action) rewrites the raw descriptions to be user-focused. It inspects PR diffs for unclear entries, normalizes tense and formatting, wraps code identifiers in backticks, and surfaces flow-on effects that commit messages obscure. If this step fails, the raw deterministic output is used as-is.

Architecture Decisions

Decision Rationale
createGithubReleases: false Prevents 20 per-package releases; our pipeline creates 1
v<version> tag format Matches existing tag convention (v1.5.6), not changesets' <pkg>@<version>
Git history as ground truth Changesets miss PRs merged without .changeset/*.md files; git log catches everything
Cherry-pick deduplication v1.5.6 is not a direct ancestor of next; PR-number filtering prevents double-counting
Tag creation via GitHub API persist-credentials: false means git push has no auth; gh api uses GH_TOKEN
continue-on-error: true on all post-publish steps npm publish is the critical path; release notes are best-effort
preview-notes pinned to ref: main Prevents feature branches from injecting code that runs with release secrets

References

Patterns and algorithms adapted from:

  • sst/opencode (MIT License): revert-cancellation algorithm (script/raw-changelog.ts), two-stage AI pipeline architecture (script/version.ts, script/changelog.ts), and changelog prompt structure (.opencode/command/changelog.md)
  • #8862: initial release automation setup (changesets migration, OIDC publishing, branch strategy)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/8975 **Author:** [@gustavovalverde](https://github.com/gustavovalverde) **Created:** 4/5/2026 **Status:** ✅ Merged **Merged:** 4/6/2026 **Merged by:** [@gustavovalverde](https://github.com/gustavovalverde) **Base:** `main` ← **Head:** `feat/release-notes-pipeline` --- ### 📝 Commits (10+) - [`9663e7e`](https://github.com/better-auth/better-auth/commit/9663e7e34237a67e80b6243682db7e31377a89e7) ci: add release notes pipeline with AI rewriting - [`522d230`](https://github.com/better-auth/better-auth/commit/522d230d278970069e5e9cdb357e2b7169efebb5) fix(ci): prevent duplicate prerelease entries and fix stable preview fallback - [`4c643a8`](https://github.com/better-auth/better-auth/commit/4c643a883795f3dc4efa8c2fcd1f2233f7fdb151) fix(ci): add id-token permission for claude-code-action in preview-notes - [`961694f`](https://github.com/better-auth/better-auth/commit/961694fcbfb9a935cd5c144006fff93116d7ddb7) fix(ci): pass github_token to claude-code-action for workflow validation - [`ad56688`](https://github.com/better-auth/better-auth/commit/ad566880f8519d50b5185a2d19f777f03fd3e633) fix(ci): index all changeset files, not just pr-*/commit-* patterns - [`422f86a`](https://github.com/better-auth/better-auth/commit/422f86a3af0ac4a33dfdd614f9882d63851f4157) fix(ci): write raw changelog in repo directory for claude-code-action access - [`cfc3356`](https://github.com/better-auth/better-auth/commit/cfc335608ebf3ef203b8efa64acca61beef99c79) fix(ci): allow Bash(gh:*) and increase max-turns for AI rewrite step - [`06227d5`](https://github.com/better-auth/better-auth/commit/06227d52b0b813f74ea3a2b4f0451206f9c6e711) fix(ci): increase max-turns to 15, limit diff inspections to most unclear entries - [`b15d7ed`](https://github.com/better-auth/better-auth/commit/b15d7edc872ca17ee29dbb7681110557217d07f9) fix(ci): rewrite AI prompt for consistent tense, code formatting, and user focus - [`ce71acc`](https://github.com/better-auth/better-auth/commit/ce71accfe376ccf884a2110bc3b33a6fa4490ac8) fix(ci): add flow-on effects guidance from opencode prompt patterns ### 📊 Changes **6 files changed** (+1295 additions, -76 deletions) <details> <summary>View changed files</summary> ➕ `.github/prompts/release-notes-rewrite.md` (+71 -0) 📝 `.github/scripts/auto-changeset.ts` (+2 -74) ➕ `.github/scripts/lib/github.ts` (+36 -0) ➕ `.github/scripts/lib/pr-analyzer.ts` (+246 -0) ➕ `.github/scripts/release-notes.ts` (+714 -0) 📝 `.github/workflows/release.yml` (+226 -2) </details> ### 📄 Description ## Summary The `changesets/action` creates one GitHub Release per published package (20 releases for a lockstep monorepo), each with wrong attribution because all changeset files share a single batch commit. This PR replaces that with a single consolidated release produced by a two-stage pipeline: deterministic data extraction followed by AI rewriting. ## Two-Stage Pipeline The release notes flow through two stages that serve different purposes but produce a single output. **Stage 1** (`release-notes.ts`) is deterministic. It uses git history as the ground truth (not changesets alone, which can miss PRs merged without changeset files), resolves actual PR authors via `gh pr view`, classifies each entry into a domain using the same scope and file-path mappings that drive `actions/labeler`, and handles the cherry-pick history gap between `main` and `next` through PR-number deduplication. **Stage 2** (`claude-code-action`) rewrites the raw descriptions to be user-focused. It inspects PR diffs for unclear entries, normalizes tense and formatting, wraps code identifiers in backticks, and surfaces flow-on effects that commit messages obscure. If this step fails, the raw deterministic output is used as-is. ## Architecture Decisions | Decision | Rationale | |----------|-----------| | `createGithubReleases: false` | Prevents 20 per-package releases; our pipeline creates 1 | | `v<version>` tag format | Matches existing tag convention (`v1.5.6`), not changesets' `<pkg>@<version>` | | Git history as ground truth | Changesets miss PRs merged without `.changeset/*.md` files; git log catches everything | | Cherry-pick deduplication | `v1.5.6` is not a direct ancestor of `next`; PR-number filtering prevents double-counting | | Tag creation via GitHub API | `persist-credentials: false` means `git push` has no auth; `gh api` uses `GH_TOKEN` | | `continue-on-error: true` on all post-publish steps | npm publish is the critical path; release notes are best-effort | | `preview-notes` pinned to `ref: main` | Prevents feature branches from injecting code that runs with release secrets | ## References Patterns and algorithms adapted from: - [sst/opencode](https://github.com/anomalyco/opencode) (MIT License): revert-cancellation algorithm (`script/raw-changelog.ts`), two-stage AI pipeline architecture (`script/version.ts`, `script/changelog.ts`), and changelog prompt structure (`.opencode/command/changelog.md`) - [#8862](https://github.com/better-auth/better-auth/pull/8862): initial release automation setup (changesets migration, OIDC publishing, branch strategy) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 22:46:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#25239