Sync eng/common directory with azure-sdk-tools for PR 1524 (#2179)
* 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>
This commit is contained in:
parent
3bb84c8de6
commit
cdb5fbfb35
@ -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"
|
||||
|
||||
@ -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)]."
|
||||
@ -212,4 +222,4 @@ function Set-ChangeLogContent {
|
||||
}
|
||||
|
||||
Set-Content -Path $ChangeLogLocation -Value $changeLogContent
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user