MCPcopy Create free account
hub / github.com/github/gh-aw / repoIsLocal

Function repoIsLocal

pkg/cli/logs_command.go:450–466  ·  view source on GitHub ↗

flattenSingleFileArtifacts applies the artifact unfold rule to downloaded artifacts Unfold rule: If an artifact download folder contains a single file, move the file to root and delete the folder This simplifies artifact access by removing unnecessary nesting for single-file artifacts downloadWorkfl

(repo string)

Source from the content-addressed store, hash-verified

448// for resolving a workflow display name: they are authoritative only when --repo points
449// to the same repository that is checked out locally.
450func repoIsLocal(repo string) bool {
451 // Strip optional HOST/ prefix (e.g. "github.com/owner/repo" → "owner/repo")
452 ownerRepo, _ := repoutil.NormalizeRepoForAPI(repo)
453
454 // Fast path: GITHUB_REPOSITORY is always the current repo in MCP server containers.
455 if envRepo := os.Getenv("GITHUB_REPOSITORY"); envRepo != "" {
456 return strings.EqualFold(ownerRepo, envRepo)
457 }
458
459 // Fallback: detect from git remote / gh CLI (result is cached on first call).
460 currentRepo, err := GetCurrentRepoSlug()
461 if err != nil {
462 logsCommandLog.Printf("Could not determine current repo slug for comparison: %v", err)
463 return false
464 }
465 return strings.EqualFold(ownerRepo, currentRepo)
466}
467
468// validateReportFileFlags returns an error if --report-file is combined with an
469// incompatible flag. --report-file only takes effect for --format markdown output

Callers 1

NewLogsCommandFunction · 0.85

Calls 4

NormalizeRepoForAPIFunction · 0.92
GetCurrentRepoSlugFunction · 0.85
GetenvMethod · 0.80
PrintfMethod · 0.45

Tested by

no test coverage detected