From 337f967e69863081c8fb65a4d38c942d4271b0b0 Mon Sep 17 00:00:00 2001 From: rojan dinc Date: Wed, 22 Dec 2021 22:55:48 +0100 Subject: [PATCH 1/4] Update ListCheckRunsOptions with new field AppID --- github/checks.go | 1 + github/checks_test.go | 7 ++++++- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/github/checks.go b/github/checks.go index 07afb7c439..d1709bd8e7 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 *int `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..4a15c0522a 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: Int(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..04b51a9767 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() int { + 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..1fc9c9d870 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 int + 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} From a962c7dcbcf6f67379afebf62e4dccc71c605a64 Mon Sep 17 00:00:00 2001 From: Rojan Dinc Date: Sat, 25 Dec 2021 18:51:35 +0100 Subject: [PATCH 2/4] Update AppID integer type Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> --- github/checks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/checks.go b/github/checks.go index d1709bd8e7..e54702d62b 100644 --- a/github/checks.go +++ b/github/checks.go @@ -234,7 +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 *int `url:"app_id,omitempty"` // Filters check runs by GitHub App id. + AppID *int64 `url:"app_id,omitempty"` // Filters check runs by GitHub App ID. ListOptions } From 921a4241ddcfc61ef11586a77f2a25757b23ef39 Mon Sep 17 00:00:00 2001 From: rojan dinc Date: Sat, 1 Jan 2022 18:33:31 +0100 Subject: [PATCH 3/4] Update AppID type in tests --- github/checks_test.go | 2 +- github/github-accessors.go | 2 +- github/github-accessors_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/github/checks_test.go b/github/checks_test.go index 4a15c0522a..1e07d31408 100644 --- a/github/checks_test.go +++ b/github/checks_test.go @@ -338,7 +338,7 @@ func TestChecksService_ListCheckRunsForRef(t *testing.T) { CheckName: String("testing"), Status: String("completed"), Filter: String("all"), - AppID: Int(1), + AppID: Int64(1), ListOptions: ListOptions{Page: 1}, } ctx := context.Background() diff --git a/github/github-accessors.go b/github/github-accessors.go index 04b51a9767..7fef083919 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -7525,7 +7525,7 @@ func (l *License) GetURL() string { } // GetAppID returns the AppID field if it's non-nil, zero value otherwise. -func (l *ListCheckRunsOptions) GetAppID() int { +func (l *ListCheckRunsOptions) GetAppID() int64 { if l == nil || l.AppID == nil { return 0 } diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 1fc9c9d870..d9a9009d4a 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -8822,7 +8822,7 @@ func TestLicense_GetURL(tt *testing.T) { } func TestListCheckRunsOptions_GetAppID(tt *testing.T) { - var zeroValue int + var zeroValue int64 l := &ListCheckRunsOptions{AppID: &zeroValue} l.GetAppID() l = &ListCheckRunsOptions{} From 1fecc18679eb3934dbb54cd46904f6715925b520 Mon Sep 17 00:00:00 2001 From: rojan dinc Date: Sun, 2 Jan 2022 00:46:13 +0100 Subject: [PATCH 4/4] Update the formatting for ListCheckRunsOptions --- github/checks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/checks.go b/github/checks.go index e54702d62b..253d351896 100644 --- a/github/checks.go +++ b/github/checks.go @@ -234,7 +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. + AppID *int64 `url:"app_id,omitempty"` // Filters check runs by GitHub App ID. ListOptions }