Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 1524 (#14620)
Browse files Browse the repository at this point in the history
* Make RELEASE_TITLE_REGEX more specific

* Update eng/common/scripts/ChangeLog-Operations.ps1

Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com>

* Update release REGEX

* tighten up changelog verification

* Ensure releaseDate is in the appriopriate format.

* Update error messages.

* Retrun false after error

Co-authored-by: Chidozie Ononiwu <chononiw@microsoft.com>
Co-authored-by: Chidozie Ononiwu <31145988+chidozieononiwu@users.noreply.github.com>
Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com>
  • Loading branch information
4 people committed May 3, 2021
1 parent d70ad0b commit d838423
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions eng/common/scripts/ChangeLog-Operations.ps1
Expand Up @@ -2,7 +2,7 @@
. "${PSScriptRoot}\logging.ps1"
. "${PSScriptRoot}\SemVer.ps1"

$RELEASE_TITLE_REGEX = "(?<releaseNoteTitle>^\#+.*(?<version>\b\d+\.\d+\.\d+([^0-9\s][^\s:]+)?)(\s+(?<releaseStatus>\(.*\)))?)"
$RELEASE_TITLE_REGEX = "(?<releaseNoteTitle>^\#+\s+(?<version>$([AzureEngSemanticVersion]::SEMVER_REGEX))(\s+(?<releaseStatus>\(.+\))))"
$CHANGELOG_UNRELEASED_STATUS = "(Unreleased)"
$CHANGELOG_DATE_FORMAT = "yyyy-MM-dd"

Expand Down Expand Up @@ -120,7 +120,17 @@ function Confirm-ChangeLogEntry {
else {
$status = $changeLogEntry.ReleaseStatus.Trim().Trim("()")
try {
[DateTime]$status
$releaseDate = [DateTime]$status
if ($status -ne ($releaseDate.ToString($CHANGELOG_DATE_FORMAT)))
{
LogError "Date must be in the format $($CHANGELOG_DATE_FORMAT)"
return $false
}
if (((Get-Date).AddMonths(-1) -gt $releaseDate) -or ($releaseDate -gt (Get-Date).AddMonths(1)))
{
LogError "The date must be within +/- one month from today."
return $false
}
}
catch {
LogError "Invalid date [ $status ] passed as status for Version [$($changeLogEntry.ReleaseVersion)]."
Expand Down Expand Up @@ -212,4 +222,4 @@ function Set-ChangeLogContent {
}

Set-Content -Path $ChangeLogLocation -Value $changeLogContent
}
}

0 comments on commit d838423

Please sign in to comment.