Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync eng/common directory with azure-sdk-tools for PR 1303 #18684

Merged
merged 15 commits into from
Feb 11, 2021
Merged
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
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