MCPcopy Create free account
hub / github.com/crashappsec/github-analyzer / NewGithubAuditor

Function NewGithubAuditor

pkg/github/auditor/auditor.go:20–45  ·  view source on GitHub ↗
(token string)

Source from the content-addressed store, hash-verified

18}
19
20func NewGithubAuditor(token string) (*GithubAuditor, error) {
21 ctx := context.Background()
22 ts := oauth2.StaticTokenSource(
23 &oauth2.Token{AccessToken: token},
24 )
25 tc := oauth2.NewClient(ctx, ts)
26
27 var client *github.Client
28 var scmURL = config.ViperEnv.ScmURL
29 if scmURL != "" {
30 log.Logger.Infof(
31 "Setting up an enteprise client for the source control management URL %s",
32 scmURL,
33 )
34
35 var err error
36 client, err = github.NewEnterpriseClient(scmURL, scmURL, tc)
37 if err != nil {
38 log.Logger.Error(err)
39 return nil, err
40 }
41 return &GithubAuditor{client: client}, nil
42 }
43
44 return &GithubAuditor{client: github.NewClient(tc)}, nil
45}
46
47// AuditOrg runs a series of checks on a given organization and returns the
48// issues found, execution state for each check run (whether it was successful

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected