Skip to content

Commit

Permalink
Merge pull request #171 from gardener/gitinfo
Browse files Browse the repository at this point in the history
add GH resource details to git info
  • Loading branch information
swilen-iwanow authored Feb 15, 2021
2 parents 11d9b41 + 93f91e4 commit d380d76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/git/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ type GitInfo struct {
Author *github.User `json:"author,omitempty"`
Contributors []*github.User `json:"contributors,omitempty"`
WebURL *string `json:"weburl,omitempty"`
SHA *string `json:"sha,omitempty"`
SHAAlias *string `json:"shaalias,omitempty"`
Path *string `json:"path,omitempty"`
}
9 changes: 9 additions & 0 deletions pkg/resourcehandlers/github/github_resource_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,15 @@ func (gh *GitHub) ReadGitInfo(ctx context.Context, uri string) ([]byte, error) {
if gitInfo == nil {
return nil, nil
}
if len(rl.SHA) > 0 {
gitInfo.SHA = &rl.SHA
}
if len(rl.SHAAlias) > 0 {
gitInfo.SHAAlias = &rl.SHAAlias
}
if len(rl.Path) > 0 {
gitInfo.Path = &rl.Path
}
if blob, err = marshallGitInfo(gitInfo); err != nil {
return nil, err
}
Expand Down

0 comments on commit d380d76

Please sign in to comment.