Skip to content

Commit ee47f3b

Browse files
azure-sdkchidozieononiwuweshaggard
authored
Sync eng/common directory with azure-sdk-tools for PR 1524 (#18450)
* Make RELEASE_TITLE_REGEX more specific * Update eng/common/scripts/ChangeLog-Operations.ps1 Co-authored-by: Wes Haggard <[email protected]> * 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 <[email protected]> Co-authored-by: Chidozie Ononiwu <[email protected]> Co-authored-by: Wes Haggard <[email protected]>
1 parent f62cb98 commit ee47f3b

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

eng/common/scripts/ChangeLog-Operations.ps1

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
. "${PSScriptRoot}\logging.ps1"
33
. "${PSScriptRoot}\SemVer.ps1"
44

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

@@ -120,7 +120,17 @@ function Confirm-ChangeLogEntry {
120120
else {
121121
$status = $changeLogEntry.ReleaseStatus.Trim().Trim("()")
122122
try {
123-
[DateTime]$status
123+
$releaseDate = [DateTime]$status
124+
if ($status -ne ($releaseDate.ToString($CHANGELOG_DATE_FORMAT)))
125+
{
126+
LogError "Date must be in the format $($CHANGELOG_DATE_FORMAT)"
127+
return $false
128+
}
129+
if (((Get-Date).AddMonths(-1) -gt $releaseDate) -or ($releaseDate -gt (Get-Date).AddMonths(1)))
130+
{
131+
LogError "The date must be within +/- one month from today."
132+
return $false
133+
}
124134
}
125135
catch {
126136
LogError "Invalid date [ $status ] passed as status for Version [$($changeLogEntry.ReleaseVersion)]."
@@ -212,4 +222,4 @@ function Set-ChangeLogContent {
212222
}
213223

214224
Set-Content -Path $ChangeLogLocation -Value $changeLogContent
215-
}
225+
}

0 commit comments

Comments
 (0)