Skip to content

Commit 54e710f

Browse files
vaindclaude
andcommitted
refactor: improve tests and remove redundant code
- Update git commit fallback tests to match exact expected output like other tests - Remove redundant $prefix variable definition (use global scope) - Add changelog entry for the new git commit fallback feature 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 45a68d5 commit 54e710f

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Features
6+
7+
- Updater now supports repositories without changelog files by falling back to git commit messages ([#116](https://github.com/getsentry/github-workflows/pull/116))
8+
59
### Breaking Changes
610

711
Updater and Danger reusable workflows are now composite actions ([#114](https://github.com/getsentry/github-workflows/pull/114))

updater/scripts/get-changelog.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ function Format-ChangelogContent {
181181
$changelog = $changelog -replace '(?<!\[)#([0-9]+)(?![\]0-9])', ('[#$1](' + $repoUrl + '/issues/$1)')
182182

183183
# Replace any links pointing to github.com so that the target PRs/Issues don't get notification
184-
$prefix = 'https?://(www\.)?github.com/'
185184
$changelog = $changelog -replace ('\(' + $prefix), '(https://github-redirect.dependabot.com/'
186185

187186
# Limit the changelog length to ~60k to allow for other text in the PR body (total PR limit is 65536 characters)

updater/tests/get-changelog.Tests.ps1

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -264,19 +264,21 @@ Features, fixes and improvements in this release have been contributed by:
264264
$actual = & "$PSScriptRoot/../scripts/get-changelog.ps1" `
265265
-RepoUrl 'https://github.com/catchorg/Catch2' -OldTag 'v3.9.1' -NewTag 'v3.10.0'
266266

267-
# Should contain the header for git commit fallback
268-
$actual | Should -Match "## Changelog"
269-
$actual | Should -Match "### Commits between v3.9.1 and v3.10.0"
267+
$expected = @'
268+
## Changelog
270269
271-
# Should contain some expected commits (filtering out version tags)
272-
$actual | Should -Match "- Forbid deducing reference types for m_predicate in FilterGenerator"
273-
$actual | Should -Match "- Make message macros \(FAIL, WARN, INFO, etc\) thread safe"
270+
### Commits between v3.9.1 and v3.10.0
274271
275-
# Should properly format PR links to prevent notifications
276-
$actual | Should -Match "github-redirect.dependabot.com"
272+
- Forbid deducing reference types for m_predicate in FilterGenerator ([#3005](https://github-redirect.dependabot.com/catchorg/Catch2/issues/3005))
273+
- Make message macros (FAIL, WARN, INFO, etc) thread safe
274+
- Improve performance of writing XML
275+
- Improve performance of writing JSON values
276+
- Don't add / to start of pkg-config file path when DESTDIR is unset
277+
- Fix color mode detection on FreeBSD by adding platform macro
278+
- Handle DESTDIR env var when generating pkgconfig files
279+
'@
277280

278-
# Should remove @mentions
279-
$actual | Should -Not -Match "@\w+"
281+
$actual | Should -Be $expected
280282
}
281283

282284
It 'git commit fallback handles PR references correctly' {
@@ -285,9 +287,9 @@ Features, fixes and improvements in this release have been contributed by:
285287
-RepoUrl 'https://github.com/catchorg/Catch2' -OldTag 'v3.9.1' -NewTag 'v3.10.0'
286288

287289
# Check that PR references are converted to links with github-redirect
288-
if ($actual -match '#(\d+)') {
289-
$actual | Should -Match '\[#\d+\]\(https://github-redirect\.dependabot\.com/catchorg/Catch2/issues/\d+\)'
290-
}
290+
$actual | Should -Match '\[#3005\]\(https://github-redirect\.dependabot\.com/catchorg/Catch2/issues/3005\)'
291+
# Should not contain raw @mentions
292+
$actual | Should -Not -Match "@\w+"
291293
}
292294

293295
It 'git commit fallback returns empty when no commits found' {
@@ -301,10 +303,14 @@ Features, fixes and improvements in this release have been contributed by:
301303
It 'git commit fallback filters out version tag commits' {
302304
# Test that version commits like "v3.10.0" are filtered out
303305
$actual = & "$PSScriptRoot/../scripts/get-changelog.ps1" `
304-
-RepoUrl 'https://github.com/catchorg/Catch2' -OldTag 'v3.9.1' -NewTag 'v3.10.0'
306+
-RepoUrl 'https://github.com/catchorg/Catch2' -OldTag 'v3.9.0' -NewTag 'v3.10.0'
305307

306-
# Should not contain version tag lines
308+
# Should not contain version tag lines (v3.9.1 and v3.10.0 are version tags in this range)
309+
$actual | Should -Not -Match "- v3\.9\.1"
307310
$actual | Should -Not -Match "- v3\.10\.0"
311+
$actual | Should -Not -Match "- 3\.9\.1"
308312
$actual | Should -Not -Match "- 3\.10\.0"
313+
# But should contain meaningful commits
314+
$actual | Should -Match "- Forbid deducing reference types"
309315
}
310316
}

0 commit comments

Comments
 (0)