Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 1303 (#18684)
Browse files Browse the repository at this point in the history
* Add PrepareRelease Script

* Update Package-Properties.ps1

* Update Collect-ChangeLog Script

* Update Collect-ChangeLog.ps1 and Collect-Unreleased.ps1

* Update GeneralReleaseNotesParser.ps1 script

* Change GeneralReleaseNotesParser logic

* Change GeneralReleaseNotesParser.ps1 logic

* Remoce GeneralReleaseNotesParsercopy

* Update collect changelog and generalreleasenotes parser logic

* Refine CollectChangelog Logic

* Add logic for filtering collected changelog

* Add Filter-ReleaseHighlights function

* Update General ReleasNotes Logic

* Delete GeneralReleaseNotesLogic.ps1

* Update Collect ChangeLogLogic

Co-authored-by: Chidozie Ononiwu <chononiw@microsoft.com>
  • Loading branch information
azure-sdk and chidozieononiwu authored Feb 11, 2021
1 parent b950cfe commit e547c1b
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions eng/common/scripts/Collect-ChangeLogs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[DateTime] $FromDate
)

. (Join-Path $PSScriptRoot common.ps1)

$releaseHighlights = @{}

if ($FromDate -as [DateTime])
{
$date = ([DateTime]$FromDate).ToString($CHANGELOG_DATE_FORMAT)
}
else {
LogWarning "Invalid date passed. Switch to using the current date"
$date = Get-Date -Format $CHANGELOG_DATE_FORMAT
}

$allPackageProps = Get-AllPkgProperties

foreach ($packageProp in $allPackageProps) {
$changeLogLocation = $packageProp.ChangeLogPath
if (!(Test-Path $changeLogLocation))
{
continue
}
$changeLogEntries = Get-ChangeLogEntries -ChangeLogLocation $changeLogLocation
$packageName = $packageProp.Name
$serviceDirectory = $packageProp.ServiceDirectory

foreach ($changeLogEntry in $changeLogEntries.Values) {
if ([System.String]::IsNullOrEmpty($changeLogEntry.ReleaseStatus))
{
continue;
}
$ReleaseStatus = $changeLogEntry.ReleaseStatus.Trim("(",")")
if (!($ReleaseStatus -as [DateTime]) -or $ReleaseStatus -lt $date)
{
continue;
}

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

$releaseTag = "${packageName}_${releaseVersion}"
$key = "${packageName}:${releaseVersion}"

$releaseHighlights[$key] = @{}
$releaseHighlights[$key]["PackageProperties"] = $packageProp
$releaseHighlights[$key]["ChangelogUrl"] = "https://github.com/Azure/azure-sdk-for-${LanguageShort}/blob/${releaseTag}/sdk/${serviceDirectory}/${packageName}/CHANGELOG.md#${githubAnchor}"
$releaseHighlights[$key]["Content"] = @()

$changeLogEntry.ReleaseContent | %{
$releaseHighlights[$key]["Content"] += $_.Replace("###", "####")
}
}
}

return $releaseHighlights

0 comments on commit e547c1b

Please sign in to comment.