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: