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

Function extractExperimentName

pkg/cli/experiments_command.go:746–754  ·  view source on GitHub ↗

extractExperimentName extracts the workflow ID from a branch ref. "origin/experiments/my-workflow" → "my-workflow" "experiments/my-workflow" → "my-workflow" "experiments/" → "" (bare prefix, rejected by callers)

(ref string)

Source from the content-addressed store, hash-verified

744// "experiments/my-workflow" → "my-workflow"
745// "experiments/" → "" (bare prefix, rejected by callers)
746func extractExperimentName(ref string) string {
747 ref = strings.TrimPrefix(ref, "origin/")
748 if !strings.HasPrefix(ref, experimentsBranchPrefix) {
749 return ""
750 }
751 // An empty result here (bare "experiments/" ref) is acceptable: callers
752 // guard against empty workflow IDs with `if workflowID == ""` checks.
753 return strings.TrimPrefix(ref, experimentsBranchPrefix)
754}
755
756// gitRefExists reports whether a git ref exists locally.
757func gitRefExists(ref string) bool {

Callers 2

fetchLocalExperimentsFunction · 0.85

Calls

no outgoing calls

Tested by 1