Skip to content

Commit

Permalink
Add release notes collect script (#14879)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym authored Sep 4, 2020
1 parent b208eea commit 76f0a7a
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions eng/scripts/Collect-Changelogs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[ValidateRange(1, 12)]
[int] $Month
)

$repoRoot = Resolve-Path "$PSScriptRoot/../..";
. ${repoRoot}\eng\common\scripts\SemVer.ps1
. ${repoRoot}\eng\common\scripts\ChangeLog-Operations.ps1
$InstallNotes = "";
$ReleaseNotes = "";

$date = Get-Date -Month $month -Format "yyyy-MM"
$date += "-\d\d"

Get-ChildItem "$repoRoot/sdk" -Filter CHANGELOG.md -Recurse | Sort-Object -Property Name | % {

$changeLogEntries = Get-ChangeLogEntries -ChangeLogLocation $_
$package = $_.Directory.Name
$serviceDirectory = $_.Directory.Parent.Name

foreach ($changeLogEntry in $changeLogEntries.Values)
{
if ($changeLogEntry.ReleaseStatus -notmatch $date)
{

continue;
}

$version = $changeLogEntry.ReleaseVersion
$githubAnchor = $changeLogEntry.ReleaseTitle.Replace("## ", "").Replace(".", "").Replace("(", "").Replace(")", "").Replace(" ", "-")

$InstallNotes += "$> dotnet add package $package --version $version`n";
$ReleaseNotes += "### $package [Changelog](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/$serviceDirectory/$package/CHANGELOG.md#$githubAnchor)`n"
$changeLogEntry.ReleaseContent | %{

$ReleaseNotes += $_.Replace("###", "####")
$ReleaseNotes += "`n"
}
$ReleaseNotes += "`n"
}
}

return $InstallNotes, $ReleaseNotes

0 comments on commit 76f0a7a

Please sign in to comment.