Skip to content

Commit 54a126b

Browse files
docs: update default for PR title notes heading
1 parent 9c8306e commit 54a126b

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ The action can be configured using the following settings:
5252
| `PatchLabels` | A comma separated list of labels that trigger a patch release. | `patch, fix` | false |
5353
| `UsePRTitleAsReleaseName` | When enabled, uses the pull request title as the name for the GitHub release. | `false` | false |
5454
| `UsePRBodyAsReleaseNotes` | When enabled, uses the pull request body as the release notes for the GitHub release. | `true` | false |
55+
| `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 |
5556
| `VersionPrefix` | The prefix to use for the version number. | `v` | false |
5657
| `WhatIf` | Control wether to simulate the action. If enabled, the action will not create any releases. Used for testing. | `false` | false |
5758
| `Debug` | Enable debug output. | `'false'` | false |

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ inputs:
5858
description: When enabled, uses the pull request body as the release notes for the GitHub release.
5959
required: false
6060
default: 'true'
61+
UsePRTitleAsNotesHeading:
62+
description: When enabled, the release notes will begin with the pull request title as a H2 heading followed by the pull request body.
63+
required: false
64+
default: 'true'
6165
VersionPrefix:
6266
description: The prefix to use for the version number.
6367
required: false
@@ -105,6 +109,7 @@ runs:
105109
PSMODULE_AUTO_RELEASE_INPUT_PatchLabels: ${{ inputs.PatchLabels }}
106110
PSMODULE_AUTO_RELEASE_INPUT_UsePRBodyAsReleaseNotes: ${{ inputs.UsePRBodyAsReleaseNotes }}
107111
PSMODULE_AUTO_RELEASE_INPUT_UsePRTitleAsReleaseName: ${{ inputs.UsePRTitleAsReleaseName }}
112+
PSMODULE_AUTO_RELEASE_INPUT_UsePRTitleAsNotesHeading: ${{ inputs.UsePRTitleAsNotesHeading }}
108113
PSMODULE_AUTO_RELEASE_INPUT_VersionPrefix: ${{ inputs.VersionPrefix }}
109114
PSMODULE_AUTO_RELEASE_INPUT_WhatIf: ${{ inputs.WhatIf }}
110115
with:

scripts/main.ps1

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ LogGroup 'Set configuration' {
4747
$incrementalPrerelease = ![string]::IsNullOrEmpty($configuration.IncrementalPrerelease) ? $configuration.IncrementalPrerelease -eq 'true' : $env:PSMODULE_AUTO_RELEASE_INPUT_IncrementalPrerelease -eq 'true'
4848
$usePRBodyAsReleaseNotes = ![string]::IsNullOrEmpty($configuration.UsePRBodyAsReleaseNotes) ? $configuration.UsePRBodyAsReleaseNotes -eq 'true' : $env:PSMODULE_AUTO_RELEASE_INPUT_UsePRBodyAsReleaseNotes -eq 'true'
4949
$usePRTitleAsReleaseName = ![string]::IsNullOrEmpty($configuration.UsePRTitleAsReleaseName) ? $configuration.UsePRTitleAsReleaseName -eq 'true' : $env:PSMODULE_AUTO_RELEASE_INPUT_UsePRTitleAsReleaseName -eq 'true'
50+
$usePRTitleAsNotesHeading = ![string]::IsNullOrEmpty($configuration.UsePRTitleAsNotesHeading) ? $configuration.UsePRTitleAsNotesHeading -eq 'true' : $env:PSMODULE_AUTO_RELEASE_INPUT_UsePRTitleAsNotesHeading -eq 'true'
5051
$versionPrefix = ![string]::IsNullOrEmpty($configuration.VersionPrefix) ? $configuration.VersionPrefix : $env:PSMODULE_AUTO_RELEASE_INPUT_VersionPrefix
5152
$whatIf = ![string]::IsNullOrEmpty($configuration.WhatIf) ? $configuration.WhatIf -eq 'true' : $env:PSMODULE_AUTO_RELEASE_INPUT_WhatIf -eq 'true'
5253

@@ -64,6 +65,7 @@ LogGroup 'Set configuration' {
6465
Write-Output "Incremental prerelease enabled: [$incrementalPrerelease]"
6566
Write-Output "Use PR body as release notes: [$usePRBodyAsReleaseNotes]"
6667
Write-Output "Use PR title as release name: [$usePRTitleAsReleaseName]"
68+
Write-Output "Use PR title as notes heading: [$usePRTitleAsNotesHeading]"
6769
Write-Output "Version prefix: [$versionPrefix]"
6870
Write-Output "What if mode: [$whatIf]"
6971
Write-Output ''
@@ -243,7 +245,13 @@ if ($createPrerelease -or $createRelease -or $whatIf) {
243245
}
244246

245247
# Add notes parameter
246-
if ($usePRBodyAsReleaseNotes) {
248+
if ($usePRTitleAsNotesHeading) {
249+
$prTitle = $pull_request.title
250+
$prBody = $pull_request.body
251+
$notes = "## $prTitle`n`n$prBody"
252+
$releaseCreateCommand += @("--notes", "$notes")
253+
Write-Output 'Using PR title as H2 heading and body as release notes'
254+
} elseif ($usePRBodyAsReleaseNotes) {
247255
$prBody = $pull_request.body
248256
$releaseCreateCommand += @("--notes", "$prBody")
249257
Write-Output 'Using PR body as release notes'
@@ -288,7 +296,13 @@ if ($createPrerelease -or $createRelease -or $whatIf) {
288296
}
289297

290298
# Add notes parameter
291-
if ($usePRBodyAsReleaseNotes) {
299+
if ($usePRTitleAsNotesHeading) {
300+
$prTitle = $pull_request.title
301+
$prBody = $pull_request.body
302+
$notes = "## $prTitle`n`n$prBody"
303+
$releaseCreateCommand += @("--notes", "$notes")
304+
Write-Output 'Using PR title as H2 heading and body as release notes'
305+
} elseif ($usePRBodyAsReleaseNotes) {
292306
$prBody = $pull_request.body
293307
$releaseCreateCommand += @("--notes", "$prBody")
294308
Write-Output 'Using PR body as release notes'

0 commit comments

Comments
 (0)