()
| 67 | } |
| 68 | |
| 69 | func (c *GithubConfig) setDefaults() { |
| 70 | if c.JobName == "" { |
| 71 | c.JobName = "GitHub" |
| 72 | } |
| 73 | if c.Collaborator == nil { |
| 74 | c.Collaborator = boolPointer(true) |
| 75 | } |
| 76 | if c.OrgMember == nil { |
| 77 | c.OrgMember = boolPointer(true) |
| 78 | } |
| 79 | if c.Owned == nil { |
| 80 | c.Owned = boolPointer(true) |
| 81 | } |
| 82 | if c.Starred == nil { |
| 83 | c.Starred = boolPointer(true) |
| 84 | } |
| 85 | httpClient := oauth2.NewClient(context.Background(), oauth2.StaticTokenSource(&oauth2.Token{AccessToken: c.AccessToken})) |
| 86 | if c.URL == "" { |
| 87 | c.client = github.NewClient(httpClient) |
| 88 | } else { |
| 89 | var err error |
| 90 | c.client, err = github.NewEnterpriseClient(fmt.Sprintf("%s/api/v3/", c.URL), fmt.Sprintf("%s/api/uploads/", c.URL), httpClient) |
| 91 | if err != nil { |
| 92 | panic(err) |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | func (c *GithubConfig) getMe() (*github.User, error) { |
| 98 | response, _, err := c.client.Users.Get(context.Background(), "") |
nothing calls this directly
no test coverage detected