Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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 |
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 H1 heading followed by the pull request body. The title will reference the pull request number.
required: false
default: 'true'
VersionPrefix:
description: The prefix to use for the version number.
required: false
Expand Down Expand Up @@ -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:
Expand Down
20 changes: 18 additions & 2 deletions scripts/main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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 ''
Expand Down Expand Up @@ -243,7 +245,14 @@ if ($createPrerelease -or $createRelease -or $whatIf) {
}

# Add notes parameter
if ($usePRBodyAsReleaseNotes) {
if ($usePRTitleAsNotesHeading) {
$prTitle = $pull_request.title
$prNumber = $pull_request.number
$prBody = $pull_request.body
$notes = "# $prTitle (#$prNumber)`n`n$prBody"
$releaseCreateCommand += @("--notes", "$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")
Write-Output 'Using PR body as release notes'
Expand Down Expand Up @@ -288,7 +297,14 @@ if ($createPrerelease -or $createRelease -or $whatIf) {
}

# Add notes parameter
if ($usePRBodyAsReleaseNotes) {
if ($usePRTitleAsNotesHeading) {
$prTitle = $pull_request.title
$prNumber = $pull_request.number
$prBody = $pull_request.body
$notes = "# $prTitle (#$prNumber)`n`n$prBody"
$releaseCreateCommand += @("--notes", "$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")
Write-Output 'Using PR body as release notes'
Expand Down
Loading