feat(ci): extract changelog generation script and use for draft releases
- Create script/generate-changelog.ts with reusable changelog generation logic
- Update ci.yml draft-release job to use the new script instead of GitHub's generate-notes API
- Ensures draft release notes follow the same format as published releases
🤖 Generated with assistance of oh-my-opencode
This commit is contained in:
22
.github/workflows/ci.yml
vendored
22
.github/workflows/ci.yml
vendored
@@ -79,26 +79,16 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get latest published release tag
|
||||
id: latest-release
|
||||
run: |
|
||||
LATEST_TAG=$(gh release list --exclude-drafts --exclude-pre-releases --limit 1 --json tagName --jq '.[0].tagName // empty')
|
||||
echo "tag=${LATEST_TAG}" >> $GITHUB_OUTPUT
|
||||
echo "Latest published release: ${LATEST_TAG:-none}"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- run: git fetch --force --tags
|
||||
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- name: Generate release notes
|
||||
id: notes
|
||||
run: |
|
||||
if [ -n "${{ steps.latest-release.outputs.tag }}" ]; then
|
||||
NOTES=$(gh api repos/${{ github.repository }}/releases/generate-notes \
|
||||
-f tag_name=next \
|
||||
-f previous_tag_name=${{ steps.latest-release.outputs.tag }} \
|
||||
--jq '.body')
|
||||
else
|
||||
NOTES="Initial release"
|
||||
fi
|
||||
NOTES=$(bun run script/generate-changelog.ts)
|
||||
echo "notes<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "$NOTES" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
Reference in New Issue
Block a user