From 54a126b9bbce8010c6ca8f16314a3aeb02517731 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 17 May 2025 11:46:38 +0200 Subject: [PATCH 1/4] docs: update default for PR title notes heading --- README.md | 1 + action.yml | 5 +++++ scripts/main.ps1 | 18 ++++++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aba9bb9..4b977d4 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ The action can be configured using the following settings: | `PatchLabels` | A comma separated list of labels that trigger a patch release. | `patch, fix` | false | | `UsePRTitleAsReleaseName` | When enabled, uses the pull request title as the name for the GitHub release. | `false` | false | | `UsePRBodyAsReleaseNotes` | When enabled, uses the pull request body as the release notes for the GitHub release. | `true` | false | +| `UsePRTitleAsNotesHeading` | When enabled, the release notes will begin with the pull request title as a H2 heading followed by the pull request body. | `true` | false | | `VersionPrefix` | The prefix to use for the version number. | `v` | false | | `WhatIf` | Control wether to simulate the action. If enabled, the action will not create any releases. Used for testing. | `false` | false | | `Debug` | Enable debug output. | `'false'` | false | diff --git a/action.yml b/action.yml index 9c1360a..248e6af 100644 --- a/action.yml +++ b/action.yml @@ -58,6 +58,10 @@ inputs: description: When enabled, uses the pull request body as the release notes for the GitHub release. required: false default: 'true' + UsePRTitleAsNotesHeading: + description: When enabled, the release notes will begin with the pull request title as a H2 heading followed by the pull request body. + required: false + default: 'true' VersionPrefix: description: The prefix to use for the version number. required: false @@ -105,6 +109,7 @@ runs: PSMODULE_AUTO_RELEASE_INPUT_PatchLabels: ${{ inputs.PatchLabels }} PSMODULE_AUTO_RELEASE_INPUT_UsePRBodyAsReleaseNotes: ${{ inputs.UsePRBodyAsReleaseNotes }} PSMODULE_AUTO_RELEASE_INPUT_UsePRTitleAsReleaseName: ${{ inputs.UsePRTitleAsReleaseName }} + PSMODULE_AUTO_RELEASE_INPUT_UsePRTitleAsNotesHeading: ${{ inputs.UsePRTitleAsNotesHeading }} PSMODULE_AUTO_RELEASE_INPUT_VersionPrefix: ${{ inputs.VersionPrefix }} PSMODULE_AUTO_RELEASE_INPUT_WhatIf: ${{ inputs.WhatIf }} with: diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 516bbc6..4b1fa3d 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -47,6 +47,7 @@ LogGroup 'Set configuration' { $incrementalPrerelease = ![string]::IsNullOrEmpty($configuration.IncrementalPrerelease) ? $configuration.IncrementalPrerelease -eq 'true' : $env:PSMODULE_AUTO_RELEASE_INPUT_IncrementalPrerelease -eq 'true' $usePRBodyAsReleaseNotes = ![string]::IsNullOrEmpty($configuration.UsePRBodyAsReleaseNotes) ? $configuration.UsePRBodyAsReleaseNotes -eq 'true' : $env:PSMODULE_AUTO_RELEASE_INPUT_UsePRBodyAsReleaseNotes -eq 'true' $usePRTitleAsReleaseName = ![string]::IsNullOrEmpty($configuration.UsePRTitleAsReleaseName) ? $configuration.UsePRTitleAsReleaseName -eq 'true' : $env:PSMODULE_AUTO_RELEASE_INPUT_UsePRTitleAsReleaseName -eq 'true' + $usePRTitleAsNotesHeading = ![string]::IsNullOrEmpty($configuration.UsePRTitleAsNotesHeading) ? $configuration.UsePRTitleAsNotesHeading -eq 'true' : $env:PSMODULE_AUTO_RELEASE_INPUT_UsePRTitleAsNotesHeading -eq 'true' $versionPrefix = ![string]::IsNullOrEmpty($configuration.VersionPrefix) ? $configuration.VersionPrefix : $env:PSMODULE_AUTO_RELEASE_INPUT_VersionPrefix $whatIf = ![string]::IsNullOrEmpty($configuration.WhatIf) ? $configuration.WhatIf -eq 'true' : $env:PSMODULE_AUTO_RELEASE_INPUT_WhatIf -eq 'true' @@ -64,6 +65,7 @@ LogGroup 'Set configuration' { Write-Output "Incremental prerelease enabled: [$incrementalPrerelease]" Write-Output "Use PR body as release notes: [$usePRBodyAsReleaseNotes]" Write-Output "Use PR title as release name: [$usePRTitleAsReleaseName]" + Write-Output "Use PR title as notes heading: [$usePRTitleAsNotesHeading]" Write-Output "Version prefix: [$versionPrefix]" Write-Output "What if mode: [$whatIf]" Write-Output '' @@ -243,7 +245,13 @@ if ($createPrerelease -or $createRelease -or $whatIf) { } # Add notes parameter - if ($usePRBodyAsReleaseNotes) { + if ($usePRTitleAsNotesHeading) { + $prTitle = $pull_request.title + $prBody = $pull_request.body + $notes = "## $prTitle`n`n$prBody" + $releaseCreateCommand += @("--notes", "$notes") + Write-Output 'Using PR title as H2 heading and body as release notes' + } elseif ($usePRBodyAsReleaseNotes) { $prBody = $pull_request.body $releaseCreateCommand += @("--notes", "$prBody") Write-Output 'Using PR body as release notes' @@ -288,7 +296,13 @@ if ($createPrerelease -or $createRelease -or $whatIf) { } # Add notes parameter - if ($usePRBodyAsReleaseNotes) { + if ($usePRTitleAsNotesHeading) { + $prTitle = $pull_request.title + $prBody = $pull_request.body + $notes = "## $prTitle`n`n$prBody" + $releaseCreateCommand += @("--notes", "$notes") + Write-Output 'Using PR title as H2 heading and body as release notes' + } elseif ($usePRBodyAsReleaseNotes) { $prBody = $pull_request.body $releaseCreateCommand += @("--notes", "$prBody") Write-Output 'Using PR body as release notes' From 362d56033aa3564db3c62dc0e43cde6490c93505 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 17 May 2025 11:49:10 +0200 Subject: [PATCH 2/4] Update action.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 248e6af..f1c2cfe 100644 --- a/action.yml +++ b/action.yml @@ -59,7 +59,7 @@ inputs: required: false default: 'true' UsePRTitleAsNotesHeading: - description: When enabled, the release notes will begin with the pull request title as a H2 heading followed by the pull request body. + description: When enabled, the release notes will begin with the pull request title as an H2 heading followed by the pull request body. required: false default: 'true' VersionPrefix: From 18d847c2203ece3ad78f60658b9185cb17c301dd Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 17 May 2025 11:49:18 +0200 Subject: [PATCH 3/4] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4b977d4..c23317d 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ The action can be configured using the following settings: | `PatchLabels` | A comma separated list of labels that trigger a patch release. | `patch, fix` | false | | `UsePRTitleAsReleaseName` | When enabled, uses the pull request title as the name for the GitHub release. | `false` | false | | `UsePRBodyAsReleaseNotes` | When enabled, uses the pull request body as the release notes for the GitHub release. | `true` | false | -| `UsePRTitleAsNotesHeading` | When enabled, the release notes will begin with the pull request title as a H2 heading followed by the pull request body. | `true` | false | +| `UsePRTitleAsNotesHeading` | When enabled, the release notes will begin with the pull request title as an H2 heading followed by the pull request body. | `true` | false | | `VersionPrefix` | The prefix to use for the version number. | `v` | false | | `WhatIf` | Control wether to simulate the action. If enabled, the action will not create any releases. Used for testing. | `false` | false | | `Debug` | Enable debug output. | `'false'` | false | From 7dd22c6ea5c476761a6d6d80fa23b196bbd7ffe5 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 17 May 2025 12:05:07 +0200 Subject: [PATCH 4/4] H1 and PR Number --- README.md | 2 +- action.yml | 2 +- scripts/main.ps1 | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c23317d..a892a3e 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ The action can be configured using the following settings: | `PatchLabels` | A comma separated list of labels that trigger a patch release. | `patch, fix` | false | | `UsePRTitleAsReleaseName` | When enabled, uses the pull request title as the name for the GitHub release. | `false` | false | | `UsePRBodyAsReleaseNotes` | When enabled, uses the pull request body as the release notes for the GitHub release. | `true` | false | -| `UsePRTitleAsNotesHeading` | When enabled, the release notes will begin with the pull request title as an H2 heading followed by the pull request body. | `true` | false | +| `UsePRTitleAsNotesHeading` | When enabled, the release notes will begin with the pull request title as a H1 heading followed by the pull request body. The title will include a reference to the PR number. | `true` | false | | `VersionPrefix` | The prefix to use for the version number. | `v` | false | | `WhatIf` | Control wether to simulate the action. If enabled, the action will not create any releases. Used for testing. | `false` | false | | `Debug` | Enable debug output. | `'false'` | false | diff --git a/action.yml b/action.yml index f1c2cfe..016e711 100644 --- a/action.yml +++ b/action.yml @@ -59,7 +59,7 @@ inputs: required: false default: 'true' UsePRTitleAsNotesHeading: - description: When enabled, the release notes will begin with the pull request title as an H2 heading followed by the pull request body. + description: When enabled, the release notes will begin with the pull request title as a H1 heading followed by the pull request body. The title will reference the pull request number. required: false default: 'true' VersionPrefix: diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 4b1fa3d..306378e 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -247,10 +247,11 @@ if ($createPrerelease -or $createRelease -or $whatIf) { # Add notes parameter if ($usePRTitleAsNotesHeading) { $prTitle = $pull_request.title + $prNumber = $pull_request.number $prBody = $pull_request.body - $notes = "## $prTitle`n`n$prBody" + $notes = "# $prTitle (#$prNumber)`n`n$prBody" $releaseCreateCommand += @("--notes", "$notes") - Write-Output 'Using PR title as H2 heading and body as release notes' + Write-Output 'Using PR title as H1 heading with link and body as release notes' } elseif ($usePRBodyAsReleaseNotes) { $prBody = $pull_request.body $releaseCreateCommand += @("--notes", "$prBody") @@ -298,10 +299,11 @@ if ($createPrerelease -or $createRelease -or $whatIf) { # Add notes parameter if ($usePRTitleAsNotesHeading) { $prTitle = $pull_request.title + $prNumber = $pull_request.number $prBody = $pull_request.body - $notes = "## $prTitle`n`n$prBody" + $notes = "# $prTitle (#$prNumber)`n`n$prBody" $releaseCreateCommand += @("--notes", "$notes") - Write-Output 'Using PR title as H2 heading and body as release notes' + Write-Output 'Using PR title as H1 heading with link and body as release notes' } elseif ($usePRBodyAsReleaseNotes) { $prBody = $pull_request.body $releaseCreateCommand += @("--notes", "$prBody")