Skip to content

Commit

Permalink
add web url to files git-data
Browse files Browse the repository at this point in the history
  • Loading branch information
g-pavlov committed Feb 10, 2021
1 parent 2b107ee commit 4e3824e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/git/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
3 changes: 3 additions & 0 deletions pkg/resourcehandlers/github/gitinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit 4e3824e

Please sign in to comment.