diff --git a/github/checks.go b/github/checks.go index 07afb7c439..253d351896 100644 --- a/github/checks.go +++ b/github/checks.go @@ -234,6 +234,7 @@ type ListCheckRunsOptions struct { CheckName *string `url:"check_name,omitempty"` // Returns check runs with the specified name. Status *string `url:"status,omitempty"` // Returns check runs with the specified status. Can be one of "queued", "in_progress", or "completed". Filter *string `url:"filter,omitempty"` // Filters check runs by their completed_at timestamp. Can be one of "latest" (returning the most recent check runs) or "all". Default: "latest" + AppID *int64 `url:"app_id,omitempty"` // Filters check runs by GitHub App ID. ListOptions } diff --git a/github/checks_test.go b/github/checks_test.go index 26da9abf78..1e07d31408 100644 --- a/github/checks_test.go +++ b/github/checks_test.go @@ -319,6 +319,7 @@ func TestChecksService_ListCheckRunsForRef(t *testing.T) { "page": "1", "status": "completed", "filter": "all", + "app_id": "1", }) fmt.Fprint(w, `{"total_count":1, "check_runs": [{ @@ -327,7 +328,9 @@ func TestChecksService_ListCheckRunsForRef(t *testing.T) { "status": "completed", "conclusion": "neutral", "started_at": "2018-05-04T01:14:52Z", - "completed_at": "2018-05-04T01:14:52Z"}]}`, + "completed_at": "2018-05-04T01:14:52Z", + "app": { + "id": 1}}]}`, ) }) @@ -335,6 +338,7 @@ func TestChecksService_ListCheckRunsForRef(t *testing.T) { CheckName: String("testing"), Status: String("completed"), Filter: String("all"), + AppID: Int64(1), ListOptions: ListOptions{Page: 1}, } ctx := context.Background() @@ -352,6 +356,7 @@ func TestChecksService_ListCheckRunsForRef(t *testing.T) { CompletedAt: &Timestamp{startedAt}, Conclusion: String("neutral"), HeadSHA: String("deadbeef"), + App: &App{ID: Int64(1)}, }}, } diff --git a/github/github-accessors.go b/github/github-accessors.go index 189e68b33b..7fef083919 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -7524,6 +7524,14 @@ func (l *License) GetURL() string { return *l.URL } +// GetAppID returns the AppID field if it's non-nil, zero value otherwise. +func (l *ListCheckRunsOptions) GetAppID() int64 { + if l == nil || l.AppID == nil { + return 0 + } + return *l.AppID +} + // GetCheckName returns the CheckName field if it's non-nil, zero value otherwise. func (l *ListCheckRunsOptions) GetCheckName() string { if l == nil || l.CheckName == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 69ed403066..d9a9009d4a 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -8821,6 +8821,16 @@ func TestLicense_GetURL(tt *testing.T) { l.GetURL() } +func TestListCheckRunsOptions_GetAppID(tt *testing.T) { + var zeroValue int64 + l := &ListCheckRunsOptions{AppID: &zeroValue} + l.GetAppID() + l = &ListCheckRunsOptions{} + l.GetAppID() + l = nil + l.GetAppID() +} + func TestListCheckRunsOptions_GetCheckName(tt *testing.T) { var zeroValue string l := &ListCheckRunsOptions{CheckName: &zeroValue}