|
365 | 365 | Set-GitHubLogGroup 'New-GitHubRelease' { |
366 | 366 | Write-Output 'Create new GitHub release' |
367 | 367 | $releaseCreateCommand = @('release', 'create', $newVersion.ToString()) |
| 368 | + $notesFilePath = $null |
368 | 369 |
|
369 | 370 | # Add title parameter |
370 | 371 | if ($usePRTitleAsReleaseName -and $pull_request.title) { |
|
375 | 376 | $releaseCreateCommand += @('--title', $newVersion.ToString()) |
376 | 377 | } |
377 | 378 |
|
378 | | - # Add notes parameter |
| 379 | + # Add notes parameter - use temp file to avoid escaping issues with special characters |
379 | 380 | if ($usePRTitleAsNotesHeading -and $usePRBodyAsReleaseNotes -and $pull_request.title -and $pull_request.body) { |
380 | 381 | $prTitle = $pull_request.title |
381 | 382 | $prNumber = $pull_request.number |
382 | 383 | $prBody = $pull_request.body |
383 | 384 | $notes = "# $prTitle (#$prNumber)`n`n$prBody" |
384 | | - $releaseCreateCommand += @('--notes', $notes) |
| 385 | + $notesFilePath = [System.IO.Path]::GetTempFileName() |
| 386 | + Set-Content -Path $notesFilePath -Value $notes -Encoding utf8 |
| 387 | + $releaseCreateCommand += @('--notes-file', $notesFilePath) |
385 | 388 | Write-Output 'Using PR title as H1 heading with link and body as release notes' |
386 | 389 | } elseif ($usePRBodyAsReleaseNotes -and $pull_request.body) { |
387 | 390 | $prBody = $pull_request.body |
388 | | - $releaseCreateCommand += @('--notes', $prBody) |
| 391 | + $notesFilePath = [System.IO.Path]::GetTempFileName() |
| 392 | + Set-Content -Path $notesFilePath -Value $prBody -Encoding utf8 |
| 393 | + $releaseCreateCommand += @('--notes-file', $notesFilePath) |
389 | 394 | Write-Output 'Using PR body as release notes' |
390 | 395 | } else { |
391 | 396 | $releaseCreateCommand += @('--generate-notes') |
|
405 | 410 | exit $LASTEXITCODE |
406 | 411 | } |
407 | 412 | } |
| 413 | + |
| 414 | + # Clean up temporary notes file if created |
| 415 | + if ($notesFilePath -and (Test-Path -Path $notesFilePath)) { |
| 416 | + Remove-Item -Path $notesFilePath -Force |
| 417 | + } |
| 418 | + |
408 | 419 | if ($whatIf) { |
409 | 420 | Write-Output 'WhatIf: gh pr comment $pull_request.number -b "The release [$newVersion] has been created."' |
410 | 421 | } else { |
|
0 commit comments