INNER CODE UNIT · Go
New
zopdev/helm-charts · charts-lint/github/client.go:16
func New(pr pullRequest) *githubClient {
return &githubClient{pr: pr}
}
// GetDiff returns unique chart names changed in the pull request.
func (c *githubClient) GetDiff() ([]string, error) {
// Get env variables for github repo
owner := os.Getenv("REPOSITORY_OWNER")
repoPath := os.Getenv("REPOSITORY_NAME")
repo := strings.Split(repoPath, "/")[1]
prNumber, err := strconv.Atoi(os.Getenv("PR_NUMBER"))
if err != nil {
return nil, err
}
// get changes in the pull request
commitFiles, _, err := c.pr.ListFiles(context.Background(), owner, repo, prNumber, nil)