Skip to content

Latest commit

 

History

History
235 lines (198 loc) · 15.8 KB

Templating.md

File metadata and controls

235 lines (198 loc) · 15.8 KB

Templating

gcg uses Go’s text/template library as the basis for the templating.

For an in-depth look into Go Templates, check the official Go docs.

Template Fields and Functions

IssuesByMilestone & IssuesByTag

IssuesByMilestone and IssuesByTag are arrays of issues and pull requests that are grouped by related labels.

IssuesByMilestone only available if milestone setting is set and IssuesByTag only available if since-tag and/or until-tag setting is set.

Example

{{range .IssuesByMilestone}}
{{.Title}}
    {{range .Issues}}
    {{- end -}}
{{end}}

SinceTag & UntilTag

SinceTag and UntilTag are tag titles which can be set by since-tag and until-tag settings and only available if they are set.

Example

{{.SinceTag}}-{{.UntilTag}}

Repository represents a GitHub repository.

Functions

Example

[{{.Repository.GetName}}]({{.Repository.GetHTMLURL}})

Milestone represents a GitHub repository milestone. Only available if milestone setting is set.

Functions

Example

{{.Milestone.GetTitle}} ({{.Milestone.GetClosedAt.Format "2006-01-02"}})

Commit (SinceTagCommit & UntilTagCommit )

Commit represents a GitHub commit. Only available if since-tag and/or until-tag setting is set.

Functions

Example

[{{.SinceTag}}]({{.SinceTagCommit.GetHTMLURL}}) - [{{.UntilTag}}]({{.UntilTagCommit.GetHTMLURL}})

Issue represents a GitHub issue on a repository.

Note: As far as the GitHub API is concerned, every pull request is an issue, but not every issue is a pull request. Some endpoints, events, and webhooks may also return pull requests via this struct. If PullRequestLinks is nil, this is an issue, and if PullRequestLinks is not nil, this is a pull request. The IsPullRequest helper method can be used to check that.

Functions

Example

{{range .IssuesByMilestone}}
{{.Title}}
{{range .Issues}}
{{if .IsPullRequest -}}
- PR [\#{{.GetNumber}}]({{.GetHTMLURL}}): {{.GetTitle}} (by [{{.GetUser.GetLogin}}]({{.GetUser.GetHTMLURL}}))
{{- else -}}
- ISSUE [\#{{.GetNumber}}]({{.GetHTMLURL}}): {{.GetTitle}}
{{- end -}}
{{end}}