-
Notifications
You must be signed in to change notification settings - Fork 62
Add automated release notes generation #846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+155
−33
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| name: Release Notes | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag-name: | ||
| description: 'Tag name (e.g. 0.17.1)' | ||
| required: true | ||
| workflow_call: | ||
| inputs: | ||
| tag-name: | ||
| description: 'Tag name for the release' | ||
| required: true | ||
| type: string | ||
| secrets: | ||
| CLAUDE_CODE_OAUTH_TOKEN: | ||
| required: false | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| release-notes: | ||
| name: Generate Release Notes | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Generate changelog from GitHub | ||
| env: | ||
| TAG_NAME: ${{ inputs.tag-name }} | ||
| run: | | ||
| gh api repos/${{ github.repository }}/releases/generate-notes \ | ||
| -f tag_name="${TAG_NAME}" \ | ||
| --jq '.body' > /tmp/changelog.md | ||
| echo "Generated changelog:" | ||
| cat /tmp/changelog.md | ||
|
|
||
| - name: Generate highlights with Claude Code | ||
| env: | ||
| CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
| TAG_NAME: ${{ inputs.tag-name }} | ||
| run: | | ||
| if [ -z "$CLAUDE_CODE_OAUTH_TOKEN" ]; then | ||
| echo "::warning::CLAUDE_CODE_OAUTH_TOKEN not set, using placeholder highlights" | ||
| printf '## Highlights\n\n_To be written._\n' > /tmp/highlights.md | ||
| exit 0 | ||
| fi | ||
|
|
||
| { | ||
| cat <<'STATIC_EOF' | ||
| You are generating the Highlights section for an OpenSwiftUI release. | ||
| OpenSwiftUI is an open source reimplementation of Apple's SwiftUI framework. | ||
|
|
||
| Below is the auto-generated changelog: | ||
|
|
||
| STATIC_EOF | ||
| cat /tmp/changelog.md | ||
| cat <<'STATIC_EOF' | ||
|
|
||
| Write ONLY a ## Highlights section with concise bullet points of key user-facing changes. | ||
| Rules: | ||
| - Skip [NFC], [CI], refactoring, docs, and internal-only changes | ||
| - Each bullet starts with a verb: Add, Fix, Improve, Update | ||
| - Keep 1-5 bullets, be concise | ||
| - Output ONLY the ## Highlights header followed by bullet points, nothing else | ||
|
|
||
| Examples from past releases: | ||
|
|
||
| ## Highlights | ||
|
|
||
| - Add Xcode Preview support | ||
| - Add initial Text support | ||
| - Add OpenSwiftUI xcframework release support | ||
|
|
||
| ## Highlights | ||
|
|
||
| - Add NS/UIApplicationDelegateAdapter support | ||
| - Add Compute backend support as an alternative to AttributeGraph | ||
| - Add NamedImage support for bundle image and system image | ||
| STATIC_EOF | ||
| } > /tmp/prompt.txt | ||
|
|
||
| npx -y @anthropic-ai/claude-code@latest \ | ||
| --model claude-opus-4-6 \ | ||
| -p "$(cat /tmp/prompt.txt)" \ | ||
| --output-format text > /tmp/highlights.md | ||
|
|
||
| echo "Generated highlights:" | ||
| cat /tmp/highlights.md | ||
|
|
||
| - name: Create release | ||
| env: | ||
| TAG_NAME: ${{ inputs.tag-name }} | ||
| run: | | ||
| { | ||
| cat /tmp/highlights.md | ||
| echo "" | ||
| cat /tmp/changelog.md | ||
| cat <<INTEGRATION_EOF | ||
|
|
||
| ## Binary Integration | ||
|
|
||
| \`\`\`swift | ||
| .package(url: "https://github.com/OpenSwiftUIProject/OpenSwiftUI-spm.git", from: "${TAG_NAME}") | ||
| \`\`\` | ||
|
|
||
| See [INTEGRATION.md](https://github.com/OpenSwiftUIProject/OpenSwiftUI/blob/main/INTEGRATION.md#binary-integration-recommended) for more details. | ||
| INTEGRATION_EOF | ||
| } > /tmp/release_notes.md | ||
|
|
||
| echo "=== Full release notes ===" | ||
| cat /tmp/release_notes.md | ||
| echo "==========================" | ||
|
|
||
| if gh release view "${TAG_NAME}" > /dev/null 2>&1; then | ||
| gh release edit "${TAG_NAME}" --notes-file /tmp/release_notes.md | ||
| else | ||
| gh release create "${TAG_NAME}" \ | ||
| --title "${TAG_NAME}" \ | ||
| --notes-file /tmp/release_notes.md | ||
| fi | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The heredoc terminator (
STATIC_EOF) is indented; in bash the terminator must start at column 1 or the heredoc won’t close and this step will fail. This also applies to the other heredocs in this workflow (includingINTEGRATION_EOF).Severity: high
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.