MCPcopy Index your code
hub / github.com/cli/cli / getOrgAndRepo

Function getOrgAndRepo

pkg/cmd/attestation/inspect/bundle.go:57–75  ·  view source on GitHub ↗
(tenant, repoURL string)

Source from the content-addressed store, hash-verified

55}
56
57func getOrgAndRepo(tenant, repoURL string) (string, string, error) {
58 var after string
59 var found bool
60 if tenant == "" {
61 after, found = strings.CutPrefix(repoURL, "https://github.com/")
62 if !found {
63 return "", "", fmt.Errorf("failed to get org and repo from %s", repoURL)
64 }
65 } else {
66 after, found = strings.CutPrefix(repoURL,
67 fmt.Sprintf("https://%s.ghe.com/", tenant))
68 if !found {
69 return "", "", fmt.Errorf("failed to get org and repo from %s", repoURL)
70 }
71 }
72
73 parts := strings.Split(after, "/")
74 return parts[0], parts[1], nil
75}
76
77func getAttestationDetail(tenant string, attr api.Attestation) (AttestationDetail, error) {
78 envelope, err := attr.Bundle.Envelope()

Callers 2

getAttestationDetailFunction · 0.85
TestGetOrgAndRepoFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by 1

TestGetOrgAndRepoFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…