Skip to content

Commit cb9da49

Browse files
SerZhyAleclaude
andcommitted
fix(release): resolve gh CLI from standard install dir when absent from PATH
publish-github-release.ps1 fell through to the unwired REST branch when gh was not on PATH (common under -NoProfile). Prepend the GitHub CLI install directory so gh detection and release-create/upload work unattended. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 57f5ca4 commit cb9da49

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

scripts/release/publish-github-release.ps1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ param(
5555

5656
$ErrorActionPreference = "Stop"
5757

58+
# Ensure the GitHub CLI is resolvable even when PATH (e.g. under -NoProfile)
59+
# omits the standard install directory. Without this, gh detection below
60+
# falls through to the unwired REST branch and publication aborts.
61+
if (-not (Get-Command gh -ErrorAction SilentlyContinue)) {
62+
foreach ($ghDir in @(
63+
(Join-Path ${env:ProgramFiles} "GitHub CLI"),
64+
(Join-Path ${env:ProgramW6432} "GitHub CLI"),
65+
(Join-Path ${env:LOCALAPPDATA} "Microsoft\WinGet\Links")
66+
)) {
67+
if ($ghDir -and (Test-Path -LiteralPath (Join-Path $ghDir "gh.exe"))) {
68+
$env:PATH = "$ghDir;$env:PATH"
69+
break
70+
}
71+
}
72+
}
73+
5874
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..")
5975
$buildGradle = Join-Path $repoRoot "app_v2/build.gradle.kts"
6076
$standardApkDir = Join-Path $repoRoot "app_v2/build/outputs/apk/standard/release"

0 commit comments

Comments
 (0)