|
| 1 | + |
| 2 | +Describe 'get-changelog' { |
| 3 | + It 'with existing versions' { |
| 4 | + $actual = & "$PSScriptRoot/../scripts/get-changelog.ps1" ` |
| 5 | + -RepoUrl 'https://github.com/getsentry/github-workflows' -OldTag '1.0.0' -NewTag '2.1.0' |
| 6 | + $expected = @' |
| 7 | +## Changelog |
| 8 | +### 2.1.0 |
| 9 | +
|
| 10 | +#### Features |
| 11 | +
|
| 12 | +- New reusable workflow, `danger.yml`, to check Pull Requests with predefined rules ([#34](https://github-redirect.dependabot.com/getsentry/github-workflows/pull/34)) |
| 13 | +
|
| 14 | +### 2.0.0 |
| 15 | +
|
| 16 | +#### Changes |
| 17 | +
|
| 18 | +- Rename `api_token` secret to `api-token` ([#21](https://github-redirect.dependabot.com/getsentry/github-workflows/pull/21)) |
| 19 | +- Change changelog target section header from "Features" to "Dependencies" ([#19](https://github-redirect.dependabot.com/getsentry/github-workflows/pull/19)) |
| 20 | +
|
| 21 | +#### Features |
| 22 | +
|
| 23 | +- Add `pr-strategy` switch to choose between creating new PRs or updating an existing one ([#22](https://github-redirect.dependabot.com/getsentry/github-workflows/pull/22)) |
| 24 | +- Add `changelog-section` input setting to specify target changelog section header ([#19](https://github-redirect.dependabot.com/getsentry/github-workflows/pull/19)) |
| 25 | +
|
| 26 | +#### Fixes |
| 27 | +
|
| 28 | +- Preserve changelog bullet-point format ([#20](https://github-redirect.dependabot.com/getsentry/github-workflows/pull/20)) |
| 29 | +- Changelog section parsing when an entry text contains the section name in the text ([#25](https://github-redirect.dependabot.com/getsentry/github-workflows/pull/25)) |
| 30 | +'@ |
| 31 | + |
| 32 | + $actual | Should -Be $expected |
| 33 | + } |
| 34 | + |
| 35 | + It 'with missing versions' { |
| 36 | + $actual = & "$PSScriptRoot/../scripts/get-changelog.ps1" ` |
| 37 | + -RepoUrl 'https://github.com/getsentry/sentry-javascript' -OldTag 'XXXXXXX' -NewTag 'YYYYYYYYY' |
| 38 | + $actual | Should -BeNullOrEmpty |
| 39 | + } |
| 40 | + |
| 41 | + It 'with missing repo' { |
| 42 | + $actual = & "$PSScriptRoot/../scripts/get-changelog.ps1" ` |
| 43 | + -RepoUrl 'https://github.com/getsentry/foo-bar' -OldTag 'XXXXXXX' -NewTag 'YYYYYYYYY' |
| 44 | + # May print a warning but still returns (an empty string) |
| 45 | + $actual | Should -BeNullOrEmpty |
| 46 | + } |
| 47 | + |
| 48 | + It 'with unsupported repo' { |
| 49 | + $actual = & "$PSScriptRoot/../scripts/get-changelog.ps1" ` |
| 50 | + -RepoUrl 'https://dart.googlesource.com/args' -OldTag 'XXXXXXX' -NewTag 'YYYYYYYYY' |
| 51 | + # May print a warning but still returns (an empty string) |
| 52 | + $actual | Should -BeNullOrEmpty |
| 53 | + } |
| 54 | + |
| 55 | + It 'removes at-mentions' { |
| 56 | + $actual = & "$PSScriptRoot/../scripts/get-changelog.ps1" ` |
| 57 | + -RepoUrl 'https://github.com/getsentry/sentry-cli' -OldTag '2.1.0' -NewTag '2.2.0' |
| 58 | + $expected = @' |
| 59 | +## Changelog |
| 60 | +### 2.2.0 |
| 61 | +
|
| 62 | +#### Various fixes & improvements |
| 63 | +
|
| 64 | +- feat: Compute and upload il2cpp line mappings ([#1248](https://github-redirect.dependabot.com/getsentry/sentry-cli/issues/1248)) by loewenheim |
| 65 | +- ref: Skip protected zip files when uploading debug files ([#1245](https://github-redirect.dependabot.com/getsentry/sentry-cli/issues/1245)) by kamilogorek |
| 66 | +'@ |
| 67 | + |
| 68 | + $actual | Should -Be $expected |
| 69 | + } |
| 70 | + |
| 71 | + It "get-changelog removes doesn't duplicate PR links" { |
| 72 | + $actual = & "$PSScriptRoot/../scripts/get-changelog.ps1" ` |
| 73 | + -RepoUrl 'https://github.com/getsentry/sentry-native' -OldTag '0.4.16' -NewTag '0.4.17' |
| 74 | + $expected = @' |
| 75 | +## Changelog |
| 76 | +### 0.4.17 |
| 77 | +
|
| 78 | +**Fixes**: |
| 79 | +
|
| 80 | +- sentry-native now successfully builds when examples aren't included. ([#702](https://github-redirect.dependabot.com/getsentry/sentry-native/pull/702)) |
| 81 | +
|
| 82 | +**Thank you**: |
| 83 | +
|
| 84 | +Features, fixes and improvements in this release have been contributed by: |
| 85 | +
|
| 86 | +- [AenBleidd](https://github-redirect.dependabot.com/AenBleidd) |
| 87 | +'@ |
| 88 | + |
| 89 | + $actual | Should -Be $expected |
| 90 | + } |
| 91 | + |
| 92 | + It 'truncates too long text' { |
| 93 | + $actual = & "$PSScriptRoot/../scripts/get-changelog.ps1" ` |
| 94 | + -RepoUrl 'https://github.com/getsentry/sentry-cli' -OldTag '1.0.0' -NewTag '2.4.0' |
| 95 | + if ($actual.Length -gt 61000) |
| 96 | + { |
| 97 | + throw "Expected the content to be truncated to less-than 61k characters, but got: $($actual.Length)" |
| 98 | + } |
| 99 | + $msg = "Changelog content truncated by [0-9]+ characters because it was over the limit \(60000\) and wouldn't fit into PR description." |
| 100 | + if ("$actual" -notmatch $msg) |
| 101 | + { |
| 102 | + Write-Host $actual |
| 103 | + throw "Expected changelog to contain message '$msg'" |
| 104 | + } |
| 105 | + } |
| 106 | +} |
0 commit comments