Skip to content

Commit 63e9552

Browse files
azure-sdkweshaggardJoshLove-msft
authored
Sync eng/common directory with azure-sdk-tools for PR 1772 (Azure#22381)
* Update change log headers based on guideline update Updates based on Azure/azure-sdk#3103 - Renamed "Key Bugs Fixed" to "Bugs Fixed" - Renamed "Fixed" to "Other Changes" Added a warning in validation if at lease one of the recommended headers aren't used. * Update eng/common/scripts/ChangeLog-Operations.ps1 Co-authored-by: JoshLove-msft <[email protected]> Co-authored-by: Wes Haggard <[email protected]> Co-authored-by: Wes Haggard <[email protected]> Co-authored-by: JoshLove-msft <[email protected]>
1 parent cb74eb8 commit 63e9552

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

eng/common/scripts/ChangeLog-Operations.ps1

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
$RELEASE_TITLE_REGEX = "(?<releaseNoteTitle>^\#+\s+(?<version>$([AzureEngSemanticVersion]::SEMVER_REGEX))(\s+(?<releaseStatus>\(.+\))))"
66
$CHANGELOG_UNRELEASED_STATUS = "(Unreleased)"
77
$CHANGELOG_DATE_FORMAT = "yyyy-MM-dd"
8+
$RecommendedSectionHeaders = @("Features Added", "Breaking Changes", "Bugs Fixed", "Other Changes")
89

910
# Returns a Collection of changeLogEntry object containing changelog info for all version present in the gived CHANGELOG
1011
function Get-ChangeLogEntries {
@@ -109,7 +110,6 @@ function Get-ChangeLogEntryAsString {
109110
return ChangeLogEntryAsString $changeLogEntry
110111
}
111112

112-
113113
function ChangeLogEntryAsString($changeLogEntry) {
114114
if (!$changeLogEntry) {
115115
return "[Missing change log entry]"
@@ -141,13 +141,13 @@ function Confirm-ChangeLogEntry {
141141
Write-Host "-----"
142142

143143
if ([System.String]::IsNullOrEmpty($changeLogEntry.ReleaseStatus)) {
144-
LogError "Entry does not have a correct release status. Please ensure the status is set to a date '($CHANGELOG_DATE_FORMAT)' or '$CHANGELOG_UNRELEASED_STATUS' if not yet released."
144+
LogError "Entry does not have a correct release status. Please ensure the status is set to a date '($CHANGELOG_DATE_FORMAT)' or '$CHANGELOG_UNRELEASED_STATUS' if not yet released. See https://aka.ms/azsdk/guideline/changelogs for more info."
145145
return $false
146146
}
147147

148148
if ($ForRelease -eq $True) {
149149
if ($changeLogEntry.ReleaseStatus -eq $CHANGELOG_UNRELEASED_STATUS) {
150-
LogError "Entry has no release date set. Please ensure to set a release date with format '$CHANGELOG_DATE_FORMAT'."
150+
LogError "Entry has no release date set. Please ensure to set a release date with format '$CHANGELOG_DATE_FORMAT'. See https://aka.ms/azsdk/guideline/changelogs for more info."
151151
return $false
152152
}
153153
else {
@@ -156,26 +156,27 @@ function Confirm-ChangeLogEntry {
156156
$releaseDate = [DateTime]$status
157157
if ($status -ne ($releaseDate.ToString($CHANGELOG_DATE_FORMAT)))
158158
{
159-
LogError "Date must be in the format $($CHANGELOG_DATE_FORMAT)"
159+
LogError "Date must be in the format $($CHANGELOG_DATE_FORMAT). See https://aka.ms/azsdk/guideline/changelogs for more info."
160160
return $false
161161
}
162162
if (((Get-Date).AddMonths(-1) -gt $releaseDate) -or ($releaseDate -gt (Get-Date).AddMonths(1)))
163163
{
164-
LogError "The date must be within +/- one month from today."
164+
LogError "The date must be within +/- one month from today. See https://aka.ms/azsdk/guideline/changelogs for more info."
165165
return $false
166166
}
167167
}
168168
catch {
169-
LogError "Invalid date [ $status ] passed as status for Version [$($changeLogEntry.ReleaseVersion)]."
169+
LogError "Invalid date [ $status ] passed as status for Version [$($changeLogEntry.ReleaseVersion)]. See https://aka.ms/azsdk/guideline/changelogs for more info."
170170
return $false
171171
}
172172
}
173173

174174
if ([System.String]::IsNullOrWhiteSpace($changeLogEntry.ReleaseContent)) {
175-
LogError "Entry has no content. Please ensure to provide some content of what changed in this version."
175+
LogError "Entry has no content. Please ensure to provide some content of what changed in this version. See https://aka.ms/azsdk/guideline/changelogs for more info."
176176
return $false
177177
}
178178

179+
$foundRecomendedSection = $false
179180
$emptySections = @()
180181
foreach ($key in $changeLogEntry.Sections.Keys)
181182
{
@@ -184,12 +185,20 @@ function Confirm-ChangeLogEntry {
184185
{
185186
$emptySections += $key
186187
}
188+
if ($RecommendedSectionHeaders -contains $key)
189+
{
190+
$foundRecomendedSection = $true
191+
}
187192
}
188193
if ($emptySections.Count -gt 0)
189194
{
190195
LogError "The changelog entry has the following sections with no content ($($emptySections -join ', ')). Please ensure to either remove the empty sections or add content to the section."
191196
return $false
192197
}
198+
if (!$foundRecomendedSection)
199+
{
200+
LogWarning "The changelog entry did not contain any of the recommended sections ($($RecommendedSectionHeaders -join ', ')), pease add at least one. See https://aka.ms/azsdk/guideline/changelogs for more info."
201+
}
193202
}
194203
return $true
195204
}
@@ -228,15 +237,12 @@ function New-ChangeLogEntry {
228237
if (!$Content) {
229238
$Content = @()
230239
$Content += ""
231-
$Content += "### Features Added"
232-
$Content += ""
233-
$Content += "### Breaking Changes"
234-
$Content += ""
235-
$Content += "### Key Bugs Fixed"
236-
$Content += ""
237-
$Content += "### Fixed"
238-
$Content += ""
239-
$Content += ""
240+
241+
foreach ($recommendedHeader in $RecommendedSectionHeaders)
242+
{
243+
$Content += "### $recommendedHeader"
244+
$Content += ""
245+
}
240246
}
241247

242248
$newChangeLogEntry = [pscustomobject]@{

0 commit comments

Comments
 (0)