function Update-PuppetModuleChangelog {
      Update Puppet module changelog via the PowerShell Module
      Update Puppet module changelog via PowerShell Module Manifest's release notes or changelog file.
    .PARAMETER PuppetModuleFolderPath
      The path to the root folder of the Puppet module.
    .PARAMETER PowerShellModuleManifestPath
      The full path to the PowerShell module's manifest file.
    .PARAMETER Confirm
      Prompts for confirmation before overwriting the file
      Shows what would happen if the function runs.
      Update-PuppetModulechangelog -PuppetModuleFolderPath ./import/powershellget -PowerShellModuleManifestPath ./mymodule.psd1
      This command will update `./import/powershellget/` based on the the release notes in `./mymodule.psd1`;
      if no release notes can be found, it will look for a changelog file in the same path and use that instead;
      if neither the changelog nor release notes can be found, the changelog will remain untouched.

  [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')]
  param (

  begin {
    Try {
      $PuppetChangelogFilePath       = Resolve-Path (Join-Path $PuppetModuleFolderPath "") -ErrorAction Stop
      $PowerShellModuleManifestPath  = Resolve-Path -Path $PowerShellModuleManifestPath -ErrorAction Stop
      $PowerShellModuleChangelogPath = Resolve-Path -Path (Join-Path (Split-Path -Parent $PowerShellModuleManifestPath) '') -ErrorAction SilentlyContinue
      $PowerShellMetadata            = Import-PSFPowerShellDataFile -Path $PowerShellModuleManifestPath -ErrorAction Stop
    } Catch {
      # Rethrow any exceptions from the above commands

  process {
    If ([string]::IsNullOrEmpty($PowerShellModuleChangelogPath)) {
      $ReleaseNotes = $PowerShellMetadata.PrivateData.PSData.ReleaseNotes
      If ($ReleaseNotes.length -gt 0) {
        $ChangelogContent = $ReleaseNotes
    } Else {
      $ChangelogContent = Get-Content $PowerShellModuleChangelogPath
    If ($ChangelogContent) {
      If ($PSCmdlet.ShouldProcess($PuppetChangelogFilePath, "Overwrite Puppet Module Changelog")) {
        Out-Utf8File -Path $PuppetChangelogFilePath -InputObject $ChangelogContent

  end {}