Documentation
¶
Index ¶
Constants ¶
const ( InfoLevel Level = "info" WarningLevel Level = "warning" ErrorLevel Level = "error" WorkspacePathEnvVar = "GITHUB_WORKSPACE" EventPathEnvVar = "GITHUB_EVENT_PATH" BaseRefEnvVar = "GITHUB_BASE_REF" NightfallAPIKeyEnvVar = "NIGHTFALL_API_KEY" MaxAnnotationsPerRequest = 50 // https://developer.github.com/v3/checks/runs/#output-object )
Variables ¶
This section is empty.
Functions ¶
func NewAuthenticatedGithubService ¶
func NewAuthenticatedGithubService(githubToken string) diffreviewer.DiffReviewer
NewAuthenticatedGithubService creates a new authenticated github service with the github token
Types ¶
type CheckRequest ¶
type CheckRequest struct {
// Commit SHA.
// Required.
SHA string `json:"sha,omitempty"`
// PullRequest number.
// Optional.
PullRequest int `json:"pull_request,omitempty"`
// Owner of the repository.
// Required.
Owner string `json:"owner,omitempty"`
// Repository name.
// Required.
Repo string `json:"repo,omitempty"`
// Name of the annotation tool.
// Optional.
Name string `json:"name,omitempty"`
}
CheckRequest represents a nightfallDLP GitHub check request.
type Client ¶
Client is a wrapper around github.Client
func NewAuthenticatedClient ¶
NewAuthenticatedClient generates an authenticated github client
func (*Client) ChecksService ¶
func (c *Client) ChecksService() githubintf.GithubChecks
ChecksService gets the github client's checks service
func (*Client) PullRequestsService ¶
func (c *Client) PullRequestsService() githubintf.GithubPullRequests
PullRequestsService gets the github client's pull requests service
func (*Client) RepositoriesService ¶
func (c *Client) RepositoriesService() githubintf.GithubRepositories
RepositoriesService gets the github client's repositories service
type Service ¶
type Service struct {
Client githubintf.GithubClient
Logger logger.Logger
CheckRequest *CheckRequest
GitDiff gitdiffintf.GitDiff
}
Service contains the github client that makes Github api calls
func (*Service) GetDiff ¶
func (s *Service) GetDiff() ([]*diffreviewer.FileDiff, error)
GetDiff retrieves the file diff from the requested pull request
func (*Service) LoadConfig ¶
func (s *Service) LoadConfig(nightfallConfigFileName string) (*nightfallconfig.Config, error)
LoadConfig gets all config values from files or environment and creates a config
func (*Service) WriteComments ¶
func (s *Service) WriteComments(comments []*diffreviewer.Comment) error
WriteComments posts the findings as annotations to the github check