-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-dev-push.ps1
More file actions
31 lines (27 loc) · 863 Bytes
/
Copy pathcheck-dev-push.ps1
File metadata and controls
31 lines (27 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[CmdletBinding()]
param()
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
$runbook = "docs/contributing/dev-push-runbook.md"
$script = Join-Path $PSScriptRoot "check-dev-push.sh"
Write-Host "Required reading: $runbook"
$gitCommand = Get-Command git.exe -ErrorAction Stop
$gitRoot = Split-Path -Parent (Split-Path -Parent $gitCommand.Source)
$candidates = @(
(Join-Path $gitRoot "bin\bash.exe"),
(Join-Path $env:ProgramFiles "Git\bin\bash.exe")
) | Where-Object { $_ -and (Test-Path -LiteralPath $_) }
$gitBash = $candidates | Select-Object -First 1
if (-not $gitBash) {
throw "Git Bash is required. Install Git for Windows or run scripts/check-dev-push.sh from a Unix shell."
}
Push-Location $root
try {
& $gitBash $script
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
}
finally {
Pop-Location
}