Skip to content

Commit 3797ff6

Browse files
authored
fix: updater SSH repos nonbot commits (#62)
1 parent dcc2284 commit 3797ff6

File tree

3 files changed

+34
-26
lines changed

3 files changed

+34
-26
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+
### Fixes
6+
7+
- Updater - non-bot commit checks in PRs for SSH repository URLs (starting with `[email protected]:`) ([#62](https://github.com/getsentry/github-workflows/pull/62))
8+
59
### Features
610

711
- Sentry-CLI integration test action: support envelopes ([#58](https://github.com/getsentry/github-workflows/pull/58))

updater/scripts/nonbot-commits.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ param(
66
)
77

88
Set-StrictMode -Version latest
9-
$ErrorActionPreference = "Stop"
9+
$ErrorActionPreference = 'Stop'
1010

11-
11+
$RepoUrl = $RepoUrl -replace '[email protected]:', 'https://github.com/'
12+
1213

1314
$tmpDir = Join-Path ([System.IO.Path]::GetTempPath()) ([System.Guid]::NewGuid())
1415
New-Item -ItemType Directory $tmpDir | Out-Null
@@ -29,7 +30,8 @@ try
2930

3031
if ($nonbotCommits.Length -gt 0)
3132
{
32-
Write-Warning "There are commits made by others than $bot"
33+
`
34+
Write-Warning "There are commits made by others than $bot"
3335
}
3436
$nonbotCommits
3537
}

updater/tests/nonbot-commits.ps1

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,34 @@ Set-StrictMode -Version latest
22

33
. "$PSScriptRoot/common/test-utils.ps1"
44

5-
function NonBotCommits([Parameter(Mandatory = $true)][string] $branch)
5+
foreach ($repoUrl in @('https://github.com/getsentry/github-workflows', '[email protected]:getsentry/github-workflows.git'))
66
{
7-
$result = & "$PSScriptRoot/../scripts/nonbot-commits.ps1" `
8-
-RepoUrl 'https://github.com/getsentry/github-workflows' -MainBranch 'main' -PrBranch $branch
9-
if (-not $?)
7+
function NonBotCommits([Parameter(Mandatory = $true)][string] $branch)
108
{
11-
throw $result
9+
$result = & "$PSScriptRoot/../scripts/nonbot-commits.ps1" -RepoUrl $repoUrl -MainBranch 'main' -PrBranch $branch
10+
if (-not $?)
11+
{
12+
throw $result
13+
}
14+
elseif ($LASTEXITCODE -ne 0)
15+
{
16+
throw "Script finished with exit code $LASTEXITCODE"
17+
}
18+
$result
1219
}
13-
elseif ($LASTEXITCODE -ne 0)
14-
{
15-
throw "Script finished with exit code $LASTEXITCODE"
16-
}
17-
$result
18-
}
1920

20-
RunTest 'empty-if-all-commits-by-bot' {
21-
$commits = NonBotCommits 'deps/updater/tests/sentry-cli.properties'
22-
AssertEqual '' "$commits"
23-
}
21+
RunTest 'empty-if-all-commits-by-bot' {
22+
$commits = NonBotCommits 'deps/updater/tests/sentry-cli.properties'
23+
AssertEqual '' "$commits"
24+
}
2425

25-
RunTest 'empty-if-branch-doesnt-exist' {
26-
$commits = NonBotCommits 'non-existent-branch'
27-
AssertEqual '' "$commits"
28-
}
26+
RunTest 'empty-if-branch-doesnt-exist' {
27+
$commits = NonBotCommits 'non-existent-branch'
28+
AssertEqual '' "$commits"
29+
}
2930

30-
RunTest 'non-empty-if-changed' {
31-
$commits = NonBotCommits 'test/nonbot-commits'
32-
AssertEqual '0b7d9cc test: keep this branch' "$commits"
33-
}
31+
RunTest 'non-empty-if-changed' {
32+
$commits = NonBotCommits 'test/nonbot-commits'
33+
AssertEqual '0b7d9cc test: keep this branch' "$commits"
34+
}
35+
}

0 commit comments

Comments
 (0)