diff --git a/pkg/git/types.go b/pkg/git/types.go index 97a5effa..ce8eecbe 100644 --- a/pkg/git/types.go +++ b/pkg/git/types.go @@ -15,4 +15,5 @@ type GitInfo struct { PublishDate *string `json:"publishdate,omitempty"` Author *github.User `json:"author,omitempty"` Contributors []*github.User `json:"contributors,omitempty"` + WebURL *string `json:"weburl,omitempty"` } diff --git a/pkg/resourcehandlers/github/gitinfo.go b/pkg/resourcehandlers/github/gitinfo.go index bf9bd0da..25dfae68 100644 --- a/pkg/resourcehandlers/github/gitinfo.go +++ b/pkg/resourcehandlers/github/gitinfo.go @@ -36,6 +36,9 @@ func transform(commits []*github.RepositoryCommit) *git.GitInfo { lastModifiedDate := nonInternalCommits[0].GetCommit().GetCommitter().GetDate().Format(git.DateFormat) gitInfo.LastModifiedDate = &lastModifiedDate + webURL := nonInternalCommits[0].GetHTMLURL() + webURL = strings.Split(webURL, "/commit/")[0] + gitInfo.WebURL = &webURL publishDate := commits[len(nonInternalCommits)-1].GetCommit().GetCommitter().GetDate().Format(git.DateFormat) gitInfo.PublishDate = &publishDate diff --git a/pkg/resourcehandlers/github/testdata/test_format_00_out.json b/pkg/resourcehandlers/github/testdata/test_format_00_out.json index 71ecb454..f7b0a4b4 100644 --- a/pkg/resourcehandlers/github/testdata/test_format_00_out.json +++ b/pkg/resourcehandlers/github/testdata/test_format_00_out.json @@ -1,6 +1,7 @@ { "lastmod": "2020-06-18 18:40:47", "publishdate": "2020-06-18 15:07:40", + "weburl": "https://github.com/gardener/documentation", "author": { "login": "a-b", "id": 52317188,