Skip to content

Commit e45167f

Browse files
Enhance release notes handling by building content from PR title and body, using a temp file to avoid escaping issues
1 parent 5e96c35 commit e45167f

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

scripts/helpers/Publish-PSModule.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,15 @@
376376
$releaseCreateCommand += @('--title', $newVersion.ToString())
377377
}
378378

379-
# Add notes parameter - use temp file to avoid escaping issues with special characters
379+
# Build release notes content. Uses temp file to avoid escaping issues with special characters.
380+
# Precedence rules for the three UsePR* parameters:
381+
# 1. UsePRTitleAsNotesHeading + UsePRBodyAsReleaseNotes: Creates "# Title (#PR)\n\nBody" format.
382+
# Requires both parameters enabled AND both PR title and body to be present.
383+
# 2. UsePRBodyAsReleaseNotes only: Uses PR body as-is for release notes.
384+
# Takes effect when heading option is disabled/missing title, but body is available.
385+
# 3. Fallback: Auto-generates notes via GitHub's --generate-notes when no PR content is used.
380386
if ($usePRTitleAsNotesHeading -and $usePRBodyAsReleaseNotes -and $pull_request.title -and $pull_request.body) {
387+
# Path 1: Full PR-based notes with title as H1 heading and PR number link
381388
$prTitle = $pull_request.title
382389
$prNumber = $pull_request.number
383390
$prBody = $pull_request.body
@@ -387,12 +394,14 @@
387394
$releaseCreateCommand += @('--notes-file', $notesFilePath)
388395
Write-Output 'Using PR title as H1 heading with link and body as release notes'
389396
} elseif ($usePRBodyAsReleaseNotes -and $pull_request.body) {
397+
# Path 2: PR body only - no heading, just the body content
390398
$prBody = $pull_request.body
391399
$notesFilePath = [System.IO.Path]::GetTempFileName()
392400
Set-Content -Path $notesFilePath -Value $prBody -Encoding utf8
393401
$releaseCreateCommand += @('--notes-file', $notesFilePath)
394402
Write-Output 'Using PR body as release notes'
395403
} else {
404+
# Path 3: Fallback to GitHub's auto-generated release notes
396405
$releaseCreateCommand += @('--generate-notes')
397406
}
398407

0 commit comments

Comments
 (0)