Skip to content

Commit bcc5a5d

Browse files
feat: add automated release notes generation
- Add .github/release.yml to categorize PRs by label in release notes - Add 'Generate Release Notes' step to manage_release.yml that calls the GitHub API to auto-generate notes and injects them into the existing draft release via gh release edit --notes-file
1 parent 0ee335e commit bcc5a5d

2 files changed

Lines changed: 52 additions & 4 deletions

File tree

.github/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# GitHub Automatic Release Notes Configuration
2+
# Categorizes pull requests by label for auto-generated release changelogs.
3+
# See: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
4+
5+
changelog:
6+
categories:
7+
- title: New Features
8+
labels:
9+
- enhancement
10+
- feature
11+
- title: Bug Fixes
12+
labels:
13+
- bug
14+
- fix
15+
- title: Ontology Changes
16+
labels:
17+
- ontology
18+
- new-term
19+
- term-update
20+
- deprecation
21+
- title: Infrastructure & CI
22+
labels:
23+
- infrastructure
24+
- ci
25+
- build
26+
- title: Documentation
27+
labels:
28+
- documentation
29+
- docs
30+
- title: Uncategorized
31+
labels:
32+
- ""
33+
- title: Other Changes
34+
labels:
35+
- "*"

.github/workflows/manage_release.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ jobs:
4444
echo "RELEASE_FILE_PATH=$(make output-release-filepath)" >> $GITHUB_OUTPUT
4545
echo "RELEASE_NAME=$(make output-release-name)" >> $GITHUB_OUTPUT
4646
47-
- name: Get basename of the release file
48-
id: get_basename
49-
run: echo "BASENAME=$(basename ${{ steps.build_release.outputs.RELEASE_FILE_PATH }})" >> $GITHUB_ENV
50-
5147
- name: Save artifacts
5248
uses: actions/upload-artifact@v4
5349
if: always()
@@ -63,6 +59,10 @@ jobs:
6359
path: ${{ env.cache-path }}
6460
key: ${{ runner.os }}-${{ env.cache-key }}
6561

62+
- name: Get basename of the release file
63+
id: get_basename
64+
run: echo "BASENAME=$(basename ${{ steps.build_release.outputs.RELEASE_FILE_PATH }})" >> $GITHUB_ENV
65+
6666
- name: Draft GitHub Release
6767
uses: actions/create-release@v1
6868
id: draft_release
@@ -83,3 +83,16 @@ jobs:
8383
asset_content_type: ${{ env.release-build-content-type }}
8484
env:
8585
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
87+
- name: Generate Release Notes
88+
run: |
89+
gh api \
90+
--method POST \
91+
-H "Accept: application/vnd.github+json" \
92+
/repos/${{ github.repository }}/releases/generate-notes \
93+
-f tag_name="${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" \
94+
--jq '.body' > /tmp/release-notes.md
95+
gh release edit "${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" \
96+
--notes-file /tmp/release-notes.md
97+
env:
98+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)