1616 version : ${{ steps.version.outputs.version }}
1717 steps :
1818 - uses : actions/checkout@v6
19+ with :
20+ fetch-depth : 0 # full history for changelog generation
1921
2022 - name : Set version from tag
2123 id : version
@@ -28,11 +30,39 @@ jobs:
2830 version="${GITHUB_REF_NAME#v}"
2931 sed -i "s/^version:.*/version: ${version}/" ha-addon/config.yaml
3032
31- - name : Commit version bump
33+ - name : Install Claude Code
34+ run : npm install -g @anthropic-ai/claude-code
35+
36+ - name : Generate changelog
37+ env :
38+ CLAUDE_CODE_OAUTH_TOKEN : ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39+ run : |
40+ VERSION="${GITHUB_REF_NAME#v}"
41+ PREV_TAG=$(git tag --sort=-version:refname | grep '^v' | sed -n '2p')
42+
43+ if [ -n "$PREV_TAG" ]; then
44+ git log --oneline "${PREV_TAG}..HEAD" > /tmp/commits.txt
45+ git diff "${PREV_TAG}..HEAD" --stat > /tmp/diffstat.txt
46+ else
47+ git log --oneline > /tmp/commits.txt
48+ echo "" > /tmp/diffstat.txt
49+ fi
50+
51+ claude -p --model claude-sonnet-4-6 --allowedTools Read,Edit \
52+ "Update ha-addon/CHANGELOG.md with a new ## ${VERSION} section after the '# Changelog' header.
53+ Read /tmp/commits.txt for the commits and /tmp/diffstat.txt for changed files.
54+ Read ha-addon/CHANGELOG.md first to match the existing style.
55+ Guidelines:
56+ - Concise, user-facing bullet points
57+ - Note breaking changes with **Breaking:**
58+ - Do not modify any other sections" \
59+ || echo "::warning::Failed to generate changelog, skipping"
60+
61+ - name : Commit release
3262 run : |
3363 git config user.name "github-actions[bot]"
3464 git config user.email "github-actions[bot]@users.noreply.github.com"
35- git add ha-addon/config.yaml
65+ git add ha-addon/config.yaml ha-addon/CHANGELOG.md
3666 git diff --cached --quiet || git commit -m "Release ${GITHUB_REF_NAME}: update add-on version"
3767 git push origin HEAD:master
3868
0 commit comments