diff --git a/.gitea/workflows/publish-psgallery.yml b/.gitea/workflows/publish-psgallery.yml index 39447ec..ff816c5 100644 --- a/.gitea/workflows/publish-psgallery.yml +++ b/.gitea/workflows/publish-psgallery.yml @@ -129,6 +129,7 @@ jobs: COMMIT_SHA: ${{ github.sha }} PR_NUMBER: ${{ github.event.pull_request.number }} PR_TITLE: ${{ github.event.pull_request.title }} + PR_BODY: ${{ github.event.pull_request.body }} PR_AUTHOR: ${{ github.event.pull_request.user.login }} SERVER_URL: ${{ github.server_url }} RUN_ID: ${{ github.run_id }} @@ -175,7 +176,17 @@ jobs: Write-Host " CHANGELOG section length: $($changelogSection.Length) chars" Write-Host "==> [4/8] Building release body" - $changelogText = if ($changelogSection) { $changelogSection } else { '_No CHANGELOG section found for this version._' } + + # The merged pull request description is the account written for humans, so it leads when present. + # Trailing co-author and generation trailers are dropped; they belong on the commit, not the release. + $prBody = '' + if (-not [string]::IsNullOrWhiteSpace($env:PR_BODY)) { + $prBody = ($env:PR_BODY -replace '(?m)^\s*(Co-Authored-By|Co-authored-by):.*$', '') + $prBody = ($prBody -replace '(?m)^\s*(Generated with|🤖 Generated with).*$', '') + $prBody = $prBody.Trim() + } + Write-Host " PR description length: $($prBody.Length) chars" + $sb = New-Object System.Text.StringBuilder [void]$sb.AppendLine("**PSInfisicalAPI $($env:VERSION)**") [void]$sb.AppendLine('') @@ -188,8 +199,33 @@ jobs: [void]$sb.AppendLine("| Merged PR | [#$($env:PR_NUMBER) $($env:PR_TITLE)]($prUrl) by @$($env:PR_AUTHOR) |") [void]$sb.AppendLine("| Workflow run | [$($env:RUN_ID)]($runUrl) |") [void]$sb.AppendLine('') - [void]$sb.AppendLine('## Changes') - [void]$sb.AppendLine($changelogText) + + if ($prBody) { + # The description carries its own headings, so it is emitted without a wrapper. + [void]$sb.AppendLine($prBody) + + # Folded so the release leads with the narrative but still records the changelog entry. + if ($changelogSection) { + [void]$sb.AppendLine('') + [void]$sb.AppendLine('
') + [void]$sb.AppendLine("CHANGELOG entry for $($env:VERSION)") + [void]$sb.AppendLine('') + [void]$sb.AppendLine($changelogSection) + [void]$sb.AppendLine('') + [void]$sb.AppendLine('
') + } + } + elseif ($changelogSection) { + [void]$sb.AppendLine('## Changes') + [void]$sb.AppendLine('') + [void]$sb.AppendLine($changelogSection) + } + else { + [void]$sb.AppendLine('## Changes') + [void]$sb.AppendLine('') + [void]$sb.AppendLine('_No pull request description or CHANGELOG section found for this version._') + } + [void]$sb.AppendLine('') [void]$sb.AppendLine('## Install') [void]$sb.AppendLine('```powershell') diff --git a/.github/workflows/publish-psgallery.yml b/.github/workflows/publish-psgallery.yml index 4a211ed..2ec2a5b 100644 --- a/.github/workflows/publish-psgallery.yml +++ b/.github/workflows/publish-psgallery.yml @@ -131,6 +131,7 @@ jobs: COMMIT_SHA: ${{ github.sha }} PR_NUMBER: ${{ github.event.pull_request.number }} PR_TITLE: ${{ github.event.pull_request.title }} + PR_BODY: ${{ github.event.pull_request.body }} PR_AUTHOR: ${{ github.event.pull_request.user.login }} SERVER_URL: ${{ github.server_url }} RUN_ID: ${{ github.run_id }} @@ -177,7 +178,17 @@ jobs: Write-Host " CHANGELOG section length: $($changelogSection.Length) chars" Write-Host "==> [4/8] Building release body" - $changelogText = if ($changelogSection) { $changelogSection } else { '_No CHANGELOG section found for this version._' } + + # The merged pull request description is the account written for humans, so it leads when present. + # Trailing co-author and generation trailers are dropped; they belong on the commit, not the release. + $prBody = '' + if (-not [string]::IsNullOrWhiteSpace($env:PR_BODY)) { + $prBody = ($env:PR_BODY -replace '(?m)^\s*(Co-Authored-By|Co-authored-by):.*$', '') + $prBody = ($prBody -replace '(?m)^\s*(Generated with|🤖 Generated with).*$', '') + $prBody = $prBody.Trim() + } + Write-Host " PR description length: $($prBody.Length) chars" + $sb = New-Object System.Text.StringBuilder [void]$sb.AppendLine("**PSInfisicalAPI $($env:VERSION)**") [void]$sb.AppendLine('') @@ -190,8 +201,33 @@ jobs: [void]$sb.AppendLine("| Merged PR | [#$($env:PR_NUMBER) $($env:PR_TITLE)]($prUrl) by @$($env:PR_AUTHOR) |") [void]$sb.AppendLine("| Workflow run | [$($env:RUN_ID)]($runUrl) |") [void]$sb.AppendLine('') - [void]$sb.AppendLine('## Changes') - [void]$sb.AppendLine($changelogText) + + if ($prBody) { + # The description carries its own headings, so it is emitted without a wrapper. + [void]$sb.AppendLine($prBody) + + # Folded so the release leads with the narrative but still records the changelog entry. + if ($changelogSection) { + [void]$sb.AppendLine('') + [void]$sb.AppendLine('
') + [void]$sb.AppendLine("CHANGELOG entry for $($env:VERSION)") + [void]$sb.AppendLine('') + [void]$sb.AppendLine($changelogSection) + [void]$sb.AppendLine('') + [void]$sb.AppendLine('
') + } + } + elseif ($changelogSection) { + [void]$sb.AppendLine('## Changes') + [void]$sb.AppendLine('') + [void]$sb.AppendLine($changelogSection) + } + else { + [void]$sb.AppendLine('## Changes') + [void]$sb.AppendLine('') + [void]$sb.AppendLine('_No pull request description or CHANGELOG section found for this version._') + } + [void]$sb.AppendLine('') [void]$sb.AppendLine('## Install') [void]$sb.AppendLine('```powershell')