Skip to content

Commit 92f2aef

Browse files
🩹 [Patch]: Refactor release notes handling to improve clarity and structure
1 parent 09e7eaf commit 92f2aef

1 file changed

Lines changed: 22 additions & 14 deletions

File tree

‎scripts/main.ps1‎

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -245,19 +245,23 @@ if ($createPrerelease -or $createRelease -or $whatIf) {
245245
}
246246

247247
# Add notes parameter
248+
$notes = ""
248249
if ($usePRTitleAsNotesHeading) {
249250
$prTitle = $pull_request.title
250251
$prNumber = $pull_request.number
252+
$notes += "# $prTitle (#$prNumber)`n`n"
253+
}
254+
if ($usePRBodyAsReleaseNotes) {
251255
$prBody = $pull_request.body
252-
$notes = "# $prTitle (#$prNumber)`n`n$prBody"
253-
$releaseCreateCommand += @("--notes", "$notes")
254-
Write-Output 'Using PR title as H1 heading with link and body as release notes'
255-
} elseif ($usePRBodyAsReleaseNotes) {
256-
$prBody = $pull_request.body
257-
$releaseCreateCommand += @("--notes", "$prBody")
258-
Write-Output 'Using PR body as release notes'
256+
$notes += $prBody
257+
}
258+
Write-Output 'gh arguments:'
259+
if (-not [string]::IsNullOrWhiteSpace($notes)) {
260+
$releaseCreateCommand += @('--notes', $notes)
261+
Write-Output "$($releaseCreateCommand -join ' ')"
259262
} else {
260263
$releaseCreateCommand += '--generate-notes'
264+
Write-Output "$($releaseCreateCommand -join ' ')"
261265
}
262266

263267
# Add remaining parameters
@@ -297,19 +301,23 @@ if ($createPrerelease -or $createRelease -or $whatIf) {
297301
}
298302

299303
# Add notes parameter
304+
$notes = ""
300305
if ($usePRTitleAsNotesHeading) {
301306
$prTitle = $pull_request.title
302307
$prNumber = $pull_request.number
308+
$notes += "# $prTitle (#$prNumber)`n`n"
309+
}
310+
if ($usePRBodyAsReleaseNotes) {
303311
$prBody = $pull_request.body
304-
$notes = "# $prTitle (#$prNumber)`n`n$prBody"
305-
$releaseCreateCommand += @("--notes", "$notes")
306-
Write-Output 'Using PR title as H1 heading with link and body as release notes'
307-
} elseif ($usePRBodyAsReleaseNotes) {
308-
$prBody = $pull_request.body
309-
$releaseCreateCommand += @("--notes", "$prBody")
310-
Write-Output 'Using PR body as release notes'
312+
$notes += $prBody
313+
}
314+
Write-Output "gh arguments:"
315+
if (-not [string]::IsNullOrWhiteSpace($notes)) {
316+
$releaseCreateCommand += @('--notes', $notes)
317+
Write-Output "$($releaseCreateCommand -join ' ')"
311318
} else {
312319
$releaseCreateCommand += '--generate-notes'
320+
Write-Output "$($releaseCreateCommand -join ' ')"
313321
}
314322

315323
if ($whatIf) {

0 commit comments

Comments
 (0)