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
10 changes: 7 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,17 @@ jobs:
cache: pnpm
cache-dependency-path: scripts/release-notes/pnpm-lock.yaml

- name: Load Amp release-notes credentials from 1Password
- name: Load Codex release-notes credentials from 1Password
id: release_notes_config
continue-on-error: true
uses: 1password/load-secrets-action@v4
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
AMP_API_KEY: ${{ secrets.OP_AMP_SECRET_ITEM }}/credential
CODEX_ACCESS_TOKEN: ${{ secrets.OP_CODEX_SECRET_ITEM }}/credential
CHATGPT_USERNAME: ${{ secrets.OP_CODEX_SECRET_ITEM }}/username
CODEX_ENDPOINT: ${{ secrets.OP_CODEX_SECRET_ITEM }}/ENDPOINT

- name: Mint release-notes GitHub App token
id: release_notes_app_token
Expand All @@ -203,7 +205,9 @@ jobs:

- name: Generate GitHub Release notes
env:
AMP_API_KEY: ${{ steps.release_notes_config.outputs.AMP_API_KEY }}
CODEX_ACCESS_TOKEN: ${{ steps.release_notes_config.outputs.CODEX_ACCESS_TOKEN }}
CHATGPT_USERNAME: ${{ steps.release_notes_config.outputs.CHATGPT_USERNAME }}
CODEX_ENDPOINT: ${{ steps.release_notes_config.outputs.CODEX_ENDPOINT }}
GH_TOKEN: ${{ steps.release_notes_app_token.outputs.token }}
run: |
set -euo pipefail
Expand Down
24 changes: 14 additions & 10 deletions scripts/release-notes/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { dirname } from "node:path";
import { Command } from "commander";
import parseChangelog from "changelog-parser";
import { Octokit } from "@octokit/rest";
import OpenAI from "openai";
import semver from "semver";
import { truncate, uniqBy } from "lodash-es";

Expand Down Expand Up @@ -129,20 +130,23 @@ ${truncate(commits, { length: 80_000, omission: "\n\n[truncated]" })}
`;

let notes = "";
if (process.env.AMP_API_KEY) {
const codexAccessToken = process.env.CODEX_ACCESS_TOKEN || process.env.OPENAI_API_KEY;
if (codexAccessToken) {
try {
const { execute } = await import("@ampcode/sdk");
for await (const message of execute({ prompt, options: { cwd: process.cwd() } })) {
if (message.type === "result") {
if (message.is_error) throw new Error(message.error ?? "Amp returned an error");
notes = message.result ?? "";
}
}
const response = await new OpenAI({
apiKey: codexAccessToken,
baseURL: process.env.CODEX_ENDPOINT || "https://chatgpt.com/backend-api/codex",
defaultHeaders: process.env.CHATGPT_USERNAME ? { "ChatGPT-Account-ID": process.env.CHATGPT_USERNAME } : undefined,
}).responses.create({
model: process.env.CODEX_MODEL || "gpt-5.5",
input: prompt,
});
notes = response.output_text ?? "";
Comment on lines +133 to +144
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 OPENAI_API_KEY fallback always routes to the ChatGPT backend

When CODEX_ACCESS_TOKEN is absent but OPENAI_API_KEY is set, codexAccessToken is non-null so the if block runs — but CODEX_ENDPOINT is also unset, so baseURL falls back to "https://chatgpt.com/backend-api/codex". A standard OpenAI API key sent to the ChatGPT backend will return an authentication error every time. The PR description explicitly calls out OPENAI_API_KEY as the new credential path, so this is the primary onboarding story for contributors without a Codex account, and it will silently fall through to the GitHub-generated notes.

Fix in Codex Fix in Claude Code

} catch (error) {
console.warn(`AI release notes unavailable: ${error.message}`);
console.warn(`Codex release notes unavailable: ${error instanceof Error ? error.message : String(error)}`);
}
Comment thread
greptile-apps[bot] marked this conversation as resolved.
} else {
console.warn("AI release notes unavailable: AMP_API_KEY is not set");
console.warn("Codex release notes unavailable: CODEX_ACCESS_TOKEN is not set");
}

if (!notes.trim()) {
Expand Down
7 changes: 1 addition & 6 deletions scripts/release-notes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
"private": true,
"type": "module",
"devDependencies": {
"@ampcode/sdk": "0.1.0-20260605144103-g77da114",
"@octokit/rest": "^22.0.1",
"changelog-parser": "^3.0.1",
"commander": "^15.0.0",
"lodash-es": "^4.18.1",
"openai": "^6.42.0",
"semver": "^7.8.2"
},
"pnpm": {
"onlyBuiltDependencies": [
"@ampcode/cli"
]
},
"packageManager": "pnpm@10.11.0"
}
86 changes: 16 additions & 70 deletions scripts/release-notes/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading