MCPcopy Create free account
hub / github.com/cli/cli / tokenHasUserCapability

Function tokenHasUserCapability

acceptance/user_capability_test.go:29–41  ·  view source on GitHub ↗
(token string)

Source from the content-addressed store, hash-verified

27See acceptance/README.md#script-metadata for details.`
28
29func tokenHasUserCapability(token string) (bool, error) {
30 switch {
31 case strings.HasPrefix(token, "ghp_"),
32 strings.HasPrefix(token, "gho_"),
33 strings.HasPrefix(token, "github_pat_"),
34 strings.HasPrefix(token, "ghu_"):
35 return true, nil
36 case strings.HasPrefix(token, "ghs_"):
37 return false, nil
38 default:
39 return false, fmt.Errorf("GH_ACCEPTANCE_TOKEN has an unsupported token prefix")
40 }
41}
42
43func requiresUserCapabilityForScript(file string) (bool, error) {
44 f, err := os.Open(file)

Callers 2

fromEnvMethod · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected