Skip to content

Commit 80476a9

Browse files
authored
fix(updater): Select first matching main branch (#165)
* test(updater): Update sentry-cli branch assertion sentry-cli currently has main and master pointing at the same HEAD, so the updater emits both names in mainBranch output. Match that fixture output instead of requiring master only. * select first * Update CHANGELOG.md
1 parent 43bf14b commit 80476a9

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
- Validate PR - Skip validation for PRs with fewer than 100 lines changed, excluding common lock files (`Cargo.lock`, `yarn.lock`, `package-lock.json`, `Pipfile.lock`, etc.). Tiny PRs no longer go through the issue-discussion loop.
99
- Add validate-pr composite action for validating non-maintainer PRs against contribution guidelines ([#153](https://github.com/getsentry/github-workflows/pull/153))
1010

11+
### Fixes
12+
13+
- Updater - Select the first branch when multiple branches point at `HEAD` ([#165](https://github.com/getsentry/github-workflows/pull/165))
14+
1115
## 3.3.0
1216

1317
### Features

updater/scripts/update-dependency.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ if ("$Tag" -eq '') {
162162
if ("$headRef" -eq '') {
163163
throw "Couldn't determine repository head (no ref returned by ls-remote HEAD"
164164
}
165-
$mainBranch = (git ls-remote --heads $url | Where-Object { $_.StartsWith($headRef) }) -replace '.*\srefs/heads/', ''
165+
$mainBranch = (git ls-remote --heads $url | Where-Object { $_.StartsWith($headRef) } | Select-Object -First 1) -replace '.*\srefs/heads/', ''
166166
}
167167

168168
$url = $url -replace '\.git$', ''

updater/tests/update-dependency.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ switch ($action)
220220
$output | Should -Contain 'latestTag=0.28.0'
221221
$output | Should -Contain 'latestTagNice=v0.28.0'
222222
$output | Should -Contain 'url=https://github.com/getsentry/sentry-cli'
223-
$output | Should -Contain 'mainBranch=master'
223+
$output | Should -Contain 'mainBranch=main'
224224
}
225225
}
226226

0 commit comments

Comments
 (0)