Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion build/scripts/Miapp/MicroAppGitHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,13 @@ function Initialize-MiappRepoBranchName {
param()

if ($env:RepoBranchName) {
return $env:RepoBranchName
git show-ref --verify --quiet "refs/remotes/origin/$env:RepoBranchName"
if ($LASTEXITCODE -eq 0) {
return $env:RepoBranchName
}

Write-Warning "RepoBranchName '$env:RepoBranchName' does not exist on origin. Falling back to origin/HEAD."
$env:RepoBranchName = $null
}

[string] $originHeadRef = (git symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>$null)
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/Miapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ $MiappConfig = @{

### Environment Variables

- `$env:RepoBranchName` - Base branch name used for comparisons (defaults to `origin/HEAD`, typically `main`, when not set)
- `$env:RepoBranchName` - Base branch name used for comparisons. A valid explicit value is preserved. An unset value, or a stale value that does not exist on the current repository's `origin`, falls back to `origin/HEAD` (typically `main`).
- `$env:MIAPP_DIR` - Directory for miapp temporary files (default: $env:USERPROFILE)

### Output
Expand Down
Loading