From 3e49f5869d686eb8e0603305df4e1beac75a2425 Mon Sep 17 00:00:00 2001 From: Atsushi Nakagawa <49147168+46158n@users.noreply.github.com> Date: Thu, 14 Jul 2022 19:48:17 +0900 Subject: [PATCH] Add RunAttempt field to AuditEntry --- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ github/orgs_audit_log.go | 1 + github/orgs_audit_log_test.go | 2 ++ 4 files changed, 21 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index 2efe1d43e3..2a176a9b7d 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -1030,6 +1030,14 @@ func (a *AuditEntry) GetRepositoryPublic() bool { return *a.RepositoryPublic } +// GetRunAttempt returns the RunAttempt field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetRunAttempt() int64 { + if a == nil || a.RunAttempt == nil { + return 0 + } + return *a.RunAttempt +} + // GetRunnerGroupID returns the RunnerGroupID field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetRunnerGroupID() int64 { if a == nil || a.RunnerGroupID == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index ac370a0f1d..0441389391 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -1216,6 +1216,16 @@ func TestAuditEntry_GetRepositoryPublic(tt *testing.T) { a.GetRepositoryPublic() } +func TestAuditEntry_GetRunAttempt(tt *testing.T) { + var zeroValue int64 + a := &AuditEntry{RunAttempt: &zeroValue} + a.GetRunAttempt() + a = &AuditEntry{} + a.GetRunAttempt() + a = nil + a.GetRunAttempt() +} + func TestAuditEntry_GetRunnerGroupID(tt *testing.T) { var zeroValue int64 a := &AuditEntry{RunnerGroupID: &zeroValue} diff --git a/github/orgs_audit_log.go b/github/orgs_audit_log.go index 52bacfed9a..be5fd24d6e 100644 --- a/github/orgs_audit_log.go +++ b/github/orgs_audit_log.go @@ -70,6 +70,7 @@ type AuditEntry struct { Repo *string `json:"repo,omitempty"` Repository *string `json:"repository,omitempty"` RepositoryPublic *bool `json:"repository_public,omitempty"` + RunAttempt *int64 `json:"run_attempt,omitempty"` RunnerGroupID *int64 `json:"runner_group_id,omitempty"` RunnerGroupName *string `json:"runner_group_name,omitempty"` RunnerID *int64 `json:"runner_id,omitempty"` diff --git a/github/orgs_audit_log_test.go b/github/orgs_audit_log_test.go index c2beca2bdd..1f06007245 100644 --- a/github/orgs_audit_log_test.go +++ b/github/orgs_audit_log_test.go @@ -207,6 +207,7 @@ func TestAuditEntry_Marshal(t *testing.T) { Repo: String("r"), Repository: String("repo"), RepositoryPublic: Bool(false), + RunAttempt: Int64(1), RunnerGroupID: Int64(1), RunnerGroupName: String("rgn"), RunnerID: Int64(1), @@ -275,6 +276,7 @@ func TestAuditEntry_Marshal(t *testing.T) { "repo": "r", "repository": "repo", "repository_public": false, + "run_attempt": 1, "runner_group_id": 1, "runner_group_name": "rgn", "runner_id": 1,