fix(sdlc): skip branch push when no origin remote exists
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
The fatal push+retry logic added in the git flow hardening broke tests that use local-only git repos without an origin remote. Check for the origin remote before attempting to push, preserving the fatal behavior in production (where origin always exists) while allowing local/test contexts to proceed without a remote. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b6e778d5ab
commit
f85fa181cf
@ -52,6 +52,10 @@ var branchCreateCmd = &cobra.Command{
|
||||
}
|
||||
}
|
||||
|
||||
// Only push if origin remote exists (skip in local-only/test contexts)
|
||||
hasOrigin := exec.Command("git", "remote", "get-url", "origin")
|
||||
hasOrigin.Dir = root
|
||||
if hasOrigin.Run() == nil {
|
||||
pushCmd := exec.Command("git", "push", "origin", "HEAD")
|
||||
pushCmd.Dir = root
|
||||
if _, err := pushCmd.CombinedOutput(); err != nil {
|
||||
@ -68,6 +72,7 @@ var branchCreateCmd = &cobra.Command{
|
||||
strings.TrimSpace(string(retryOut)), retryErr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create the git branch
|
||||
branchName := manifest.Name
|
||||
|
||||
Loading…
Reference in New Issue
Block a user