Skip to content

Commit 8ced2bd

Browse files
committed
feat: add from v1.2.3 to the changelog entry
1 parent bddba45 commit 8ced2bd

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

scripts/update-changelog.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ for ($i = 0; $i -lt $lines.Count; $i++)
105105
$sectionEnd = $i
106106

107107
$tagAnchor = $NewTag.Replace('.', '')
108+
$oldTagNice = ($OldTag -match "^[0-9]") ? "v$OldTag" : $OldTag
108109
$newTagNice = ($NewTag -match "^[0-9]") ? "v$NewTag" : $NewTag
109110

110111
$PullRequestMD = "[#$($PR | Split-Path -Leaf)]($PR)"
@@ -113,7 +114,7 @@ $PullRequestMD = "[#$($PR | Split-Path -Leaf)]($PR)"
113114
$updated = $false
114115
for ($i = 0; $i -lt $sectionEnd; $i++)
115116
{
116-
if (($lines[$i] -match "^- Bump $Name to") -and `
117+
if (($lines[$i] -match "^- Bump $Name.*to") -and `
117118
($lines[$i + 1] -match "^ - \[changelog\]\($RepoUrl") -and `
118119
($lines[$i + 2] -match "^ - \[diff\]\($RepoUrl"))
119120
{
@@ -122,7 +123,7 @@ for ($i = 0; $i -lt $sectionEnd; $i++)
122123
Write-Host " ", $lines[$i + 1]
123124
Write-Host " ", $lines[$i + 2]
124125

125-
$lines[$i] = $lines[$i] -replace "Bump $Name to .* \(", "Bump $Name to $newTagNice ("
126+
$lines[$i] = $lines[$i] -replace "(Bump $Name.*)to .* \(", "`$1to $newTagNice ("
126127
$lines[$i] = $lines[$i] -replace "\)$", ", $PullRequestMD)"
127128
$lines[$i + 1] = " - [changelog]($RepoUrl/blob/$MainBranch/CHANGELOG.md#$tagAnchor)"
128129
$lines[$i + 2] = $lines[$i + 2] -replace "\.\.\..*\)$", "...$NewTag)"
@@ -138,7 +139,7 @@ for ($i = 0; $i -lt $sectionEnd; $i++)
138139

139140
if (!$updated)
140141
{
141-
$entry = @("- Bump $Name to $newTagNice ($PullRequestMD)",
142+
$entry = @("- Bump $Name from $oldTagNice to $newTagNice ($PullRequestMD)",
142143
" - [changelog]($RepoUrl/blob/$MainBranch/CHANGELOG.md#$tagAnchor)",
143144
" - [diff]($RepoUrl/compare/$OldTag...$NewTag)")
144145

tests/testdata/changelog/new-second-section/CHANGELOG.md.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
- Capture `Debug.LogError()` and `Debug.LogException()` also on background threads ([#673](https://github.com/getsentry/sentry-unity/pull/673))
1313
- Adding override for Sentry CLI URL ([#666](https://github.com/getsentry/sentry-unity/pull/666))
14-
- Bump Dependency to v7.17.0 ([#123](https://github.com/getsentry/dependant/pulls/123))
14+
- Bump Dependency from v7.16.0 to v7.17.0 ([#123](https://github.com/getsentry/dependant/pulls/123))
1515
- [changelog](https://github.com/getsentry/dependency/blob/main/CHANGELOG.md#7170)
1616
- [diff](https://github.com/getsentry/dependency/compare/7.16.0...7.17.0)
1717

tests/testdata/changelog/new/CHANGELOG.md.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### Features
66

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

0 commit comments

Comments
 (0)