Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion updater/scripts/update-changelog.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ if (!$updated)
{
# Find what character is used as a bullet-point separator - look for the first bullet-point object that wasn't created by this script.
$bulletPoint = $lines | Where-Object { ($_ -match '^ *[-*] ') -and -not ($_ -match '(Bump .* to|\[changelog\]|\[diff\])') } | Select-Object -First 1
$bulletPoint = "$($bulletPoint.Trim())-"[0]
$bulletPoint = "$("$bulletPoint".Trim())-"[0]
$entry = @("$bulletPoint Bump $Name from $oldTagNice to $newTagNice ($PullRequestMD)",
" $bulletPoint [changelog]($RepoUrl/blob/$MainBranch/CHANGELOG.md#$tagAnchor)",
" $bulletPoint [diff]($RepoUrl/compare/$OldTag...$NewTag)")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

## Unreleased

### Dependencies

- Bump Dependency from v7.16.0 to v7.17.0 ([#123](https://github.com/getsentry/dependant/pulls/123))
- [changelog](https://github.com/getsentry/dependency/blob/main/CHANGELOG.md#7170)
- [diff](https://github.com/getsentry/dependency/compare/7.16.0...7.17.0)

## 0.14.0

### Dependencies

This section contains only plain text with no bullet points.
The update-changelog script should handle this case gracefully.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

## 0.14.0

### Dependencies

This section contains only plain text with no bullet points.
The update-changelog script should handle this case gracefully.
16 changes: 16 additions & 0 deletions updater/tests/update-changelog.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,20 @@ Describe 'update-changelog' {
# verify the full output matches expected
Get-Content "$testCasePath/CHANGELOG.md" | Should -Be (Get-Content "$testCasePath/CHANGELOG.md.expected")
}

It 'should handle changelogs with no bullet points by defaulting to dash' {
$testCasePath = "$PSScriptRoot/testdata/changelog/no-bullet-points"
Copy-Item "$testCasePath/CHANGELOG.md.original" "$testCasePath/CHANGELOG.md"

pwsh -WorkingDirectory $testCasePath -File "$PSScriptRoot/../scripts/update-changelog.ps1" `
-Name 'Dependency' `
-PR 'https://github.com/getsentry/dependant/pulls/123' `
-RepoUrl 'https://github.com/getsentry/dependency' `
-MainBranch 'main' `
-OldTag '7.16.0' `
-NewTag '7.17.0' `
-Section 'Dependencies'

Get-Content "$testCasePath/CHANGELOG.md" | Should -Be (Get-Content "$testCasePath/CHANGELOG.md.expected")
}
}
Loading