name: AI Release Notes # Generate AI-powered release notes on new releases # Analyzes commits since last release and generates structured notes # Estimated cost: ~$1.50/release on: release: types: [created] workflow_dispatch: inputs: tag: description: "Release tag to generate notes for (e.g. v1.2.0)" required: true type: string concurrency: group: release-notes cancel-in-progress: false jobs: generate: name: Generate Release Notes runs-on: ubuntu-latest permissions: contents: write env: RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }} steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - name: Validate required secrets env: HAS_API_KEY: ${{ secrets.ANTHROPIC_API_KEY != '' }} run: | if [ "$HAS_API_KEY" != "true" ]; then echo "::error::ANTHROPIC_API_KEY not configured" exit 1 fi echo "Required secrets present" - name: Validate release tag format run: | if ! echo "$RELEASE_TAG" | grep -qE '^v?[0-9]+\.[0-9]+'; then echo "::error::Invalid release tag format: $RELEASE_TAG (expected vX.Y.Z or X.Y.Z)" exit 1 fi - name: Get previous release tag id: prev_tag run: | PREV_TAG=$(git tag --sort=-v:refname | grep -Fxv "$RELEASE_TAG" | head -1) if [ -z "$PREV_TAG" ]; then PREV_TAG=$(git rev-list --max-parents=0 HEAD | head -1) echo "No previous tag found, using initial commit: $PREV_TAG" fi echo "prev_tag=$PREV_TAG" >> $GITHUB_OUTPUT echo "Previous release: $PREV_TAG" - name: Generate Release Notes uses: anthropics/claude-code-action@9db782c3a17ef2bfc274cd17411bc3e0a5ba1345 # v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} prompt: | Generate release notes for ODS release ${{ env.RELEASE_TAG }}. ## Instructions 1. Get the commit log since the previous release: `git log ${{ steps.prev_tag.outputs.prev_tag }}..${{ env.RELEASE_TAG }} --oneline --no-merges` 2. Also check the full diff for a high-level understanding: `git diff --stat ${{ steps.prev_tag.outputs.prev_tag }}..${{ env.RELEASE_TAG }}` 3. Categorize changes into these sections: - **New Features**: New functionality added - **Improvements**: Enhancements to existing features - **Bug Fixes**: Issues resolved - **Security**: Security-related changes - **CI/CD**: Pipeline and automation changes - **Documentation**: Doc updates - **Dependencies**: Dependency updates - **Breaking Changes**: Changes that may affect existing users 4. Update the release body using: ``` gh release edit ${{ env.RELEASE_TAG }} --notes "$(cat <<'NOTES' NOTES )" ``` ## Format Use this format for the release notes: ```markdown ## What's Changed ### New Features - Feature description (#PR_NUMBER) ### Improvements - Improvement description (#PR_NUMBER) ### Bug Fixes - Fix description (#PR_NUMBER) [... other sections as applicable ...] ### Contributors - @username **Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.prev_tag.outputs.prev_tag }}...${{ env.RELEASE_TAG }} ``` Only include sections that have actual changes. Skip empty sections. claude_args: >- --allowedTools "Bash(git log *),Bash(git diff *),Bash(gh release edit *),Bash(gh pr list *),Read,Glob,Grep" --max-turns 10