From a5e79b4386251606f367062176ac004d487c2c18 Mon Sep 17 00:00:00 2001 From: Bonajo Date: Thu, 3 Dec 2026 09:12:00 +0100 Subject: [PATCH] ci: use GitHub's generated release notes to credit PR authors After a release, the notes are replaced by GitHub's generated notes: every merged PR "by @author", a "New Contributors" section and a Full Changelog link, as on releases made with "Generate release notes". semantic-release's notes come from git commits, which carry no GitHub usernames. --- .github/workflows/release.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e12a7fd..2567135 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -66,6 +66,25 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # The release notes are GitHub's generated notes, as on releases made by + # hand with "Generate release notes": every merged PR "by @author" and a + # "New Contributors" section, so contributors whose PR is merged get + # credited. semantic-release's own notes come from git commits, which + # carry no GitHub usernames; they remain in the release commit message. + - name: Use GitHub's generated release notes + if: steps.semantic.outputs.new_release_published == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ steps.semantic.outputs.new_release_git_tag }} + PREVIOUS_TAG: ${{ steps.semantic.outputs.last_release_git_tag }} + run: | + args=(-f "tag_name=$TAG") + if [ -n "$PREVIOUS_TAG" ]; then + args+=(-f "previous_tag_name=$PREVIOUS_TAG") + fi + gh api "repos/$GITHUB_REPOSITORY/releases/generate-notes" "${args[@]}" --jq .body > "$RUNNER_TEMP/notes.md" + gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" --notes-file "$RUNNER_TEMP/notes.md" + # The version to publish: the one semantic-release just cut, or the pushed # tag without its leading v. Skipped when there is nothing to publish. version: