diff --git a/eng/common/scripts/ChangeLog-Operations.ps1 b/eng/common/scripts/ChangeLog-Operations.ps1 index 0f02790ce4..8547791afc 100644 --- a/eng/common/scripts/ChangeLog-Operations.ps1 +++ b/eng/common/scripts/ChangeLog-Operations.ps1 @@ -2,7 +2,7 @@ . "${PSScriptRoot}\logging.ps1" . "${PSScriptRoot}\SemVer.ps1" -$RELEASE_TITLE_REGEX = "(?^\#+.*(?\b\d+\.\d+\.\d+([^0-9\s][^\s:]+)?)(\s+(?\(.*\)))?)" +$RELEASE_TITLE_REGEX = "(?^\#+\s+(?$([AzureEngSemanticVersion]::SEMVER_REGEX))(\s+(?\(.+\))))" $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 -} \ No newline at end of file +}