Skip to content

Commit da9998e

Browse files
committed
feat: switch to claude-code-action for release notes generation
1 parent fc1318c commit da9998e

File tree

6 files changed

+105
-241
lines changed

6 files changed

+105
-241
lines changed

.github/actions/anthropic-release-notes/action.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/actions/anthropic-release-notes/index.js

Lines changed: 0 additions & 201 deletions
This file was deleted.

.github/prompts/release-notes.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
The new version is ${{ steps.version.outputs.version }}.
2+
The previous tag is ${{ steps.version.outputs.previous_tag }}.
3+
4+
I have prepared some context for you:
5+
6+
## Recent Commits
7+
${{ steps.context.outputs.commits }}
8+
9+
## Changed Files Statistics
10+
${{ steps.context.outputs.stats }}
11+
12+
Task:
13+
1. Analyze the changes provided in the context.
14+
2. Run `git diff ${{ steps.version.outputs.previous_tag }}` to inspect the actual code changes.
15+
3. Verify that the tool descriptions in `package.json` match the implementation. Update them if necessary.
16+
4. Update CHANGELOG.md with a new section for ${{ steps.version.outputs.version }}.
17+
5. Update README.md if necessary based on the changes.
18+
6. Update package.json description if the project scope has evolved significantly.
19+
7. Create a file named RELEASE_NOTES.md containing the release notes body for this version.

.github/workflows/ci.yml

Lines changed: 83 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ jobs:
5454
contents: write
5555
outputs:
5656
version: ${{ steps.version.outputs.version }}
57+
env:
58+
USE_CODEX: 'false' # Set to 'true' to use OpenAI Codex instead of Claude
5759
steps:
5860
- name: Checkout repository
5961
uses: actions/checkout@v4
@@ -76,8 +78,9 @@ jobs:
7678
script: |
7779
const latestRelease = await github.rest.repos.getLatestRelease({ owner: context.repo.owner, repo: context.repo.repo }).catch(()=>null);
7880
let nextVersion;
81+
let prevTagRaw = '';
7982
if (latestRelease) {
80-
const prevTagRaw = latestRelease.data.tag_name || '';
83+
prevTagRaw = latestRelease.data.tag_name || '';
8184
const prev = prevTagRaw.replace(/^v/, '');
8285
const parts = prev.split('.');
8386
if (parts.length !== 3 || parts.some(p => isNaN(Number(p)))) {
@@ -91,21 +94,91 @@ jobs:
9194
}
9295
core.info(`Computed next version: ${nextVersion}`);
9396
core.setOutput('version', nextVersion);
97+
core.setOutput('previous_tag', prevTagRaw);
9498
95-
- name: Create and push tag
99+
- name: Configure Git
100+
run: |
101+
git config user.name "github-actions[bot]"
102+
git config user.email "github-actions[bot]@users.noreply.github.com"
103+
104+
- name: Generate Context
105+
id: context
106+
run: |
107+
PREV_TAG="${{ steps.version.outputs.previous_tag }}"
108+
if [ -n "$PREV_TAG" ]; then
109+
RANGE="$PREV_TAG..HEAD"
110+
echo "Generating context for range: $RANGE"
111+
else
112+
RANGE=""
113+
echo "Generating context for initial release (all history)"
114+
fi
115+
116+
{
117+
echo 'commits<<EOF'
118+
git log --pretty=format:"- %s (%an) [%h]" $RANGE
119+
echo ''
120+
echo 'EOF'
121+
} >> $GITHUB_OUTPUT
122+
123+
{
124+
echo 'stats<<EOF'
125+
if [ -n "$RANGE" ]; then
126+
git diff --stat $RANGE
127+
else
128+
git show --stat
129+
fi
130+
echo 'EOF'
131+
} >> $GITHUB_OUTPUT
132+
133+
- name: Read Prompt
134+
id: prompt
135+
run: |
136+
PROMPT=$(cat .github/prompts/release-notes.md)
137+
echo "prompt<<EOF" >> $GITHUB_OUTPUT
138+
echo "$PROMPT" >> $GITHUB_OUTPUT
139+
echo "EOF" >> $GITHUB_OUTPUT
140+
141+
- name: Update docs, tag, and release with Claude
142+
if: env.USE_CODEX != 'true'
143+
uses: anthropics/claude-code-action@v1
96144
env:
97-
VERSION: ${{ steps.version.outputs.version }}
145+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146+
with:
147+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
148+
prompt: ${{ steps.prompt.outputs.prompt }}
149+
claude_args: |
150+
--allowedTools "Read,Write,Edit,Bash(git:*)"
151+
152+
- name: Update docs, tag, and release with Codex
153+
if: env.USE_CODEX == 'true'
154+
uses: openai/codex-action@v1
155+
with:
156+
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
157+
prompt: ${{ steps.prompt.outputs.prompt }}
158+
sandbox: workspace-write
159+
codex-args: '["--allowedTools", "Read,Write,Edit,Bash(git:*)"]'
160+
161+
- name: Commit and Push Changes
98162
run: |
99-
if git rev-parse ${VERSION} >/dev/null 2>&1; then echo "Tag ${VERSION} already exists"; else git tag ${VERSION}; git push origin ${VERSION}; fi
163+
git add CHANGELOG.md README.md package.json
164+
if git diff --staged --quiet; then
165+
echo "No changes to commit"
166+
else
167+
git commit -m "docs: update for release ${{ steps.version.outputs.version }} [skip ci]"
168+
git push origin main
169+
fi
170+
171+
- name: Create Tag
172+
run: |
173+
git tag ${{ steps.version.outputs.version }}
174+
git push origin ${{ steps.version.outputs.version }}
100175
101-
- name: Generate release notes & create release
102-
uses: ./.github/actions/anthropic-release-notes
176+
- name: Create Release
177+
uses: softprops/action-gh-release@v1
103178
with:
104-
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
105-
language: en
106-
model: claude-3-5-sonnet-latest
179+
tag_name: ${{ steps.version.outputs.version }}
180+
body_path: RELEASE_NOTES.md
107181
token: ${{ secrets.GITHUB_TOKEN }}
108-
version: ${{ steps.version.outputs.version }}
109182

110183
package:
111184
name: Package Extension

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ score_tally.txt
77
coverage
88
.nyc_output
99
Issues.md
10-
*.vsix
10+
*.vsixRELEASE_NOTES.md

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@
412412
]
413413
}
414414
}
415-
}
416-
,"required": [
415+
},
416+
"required": [
417417
"workspaceFolder",
418418
"breakpointConfig"
419419
]
@@ -553,6 +553,3 @@
553553
"glob": "10.5.0"
554554
}
555555
}
556-
557-
558-

0 commit comments

Comments
 (0)