From ac02eced47b7b6d7db697285f70e3fc955cbe37e Mon Sep 17 00:00:00 2001 From: Khanh Ngo Date: Fri, 15 Dec 2023 16:42:48 +0100 Subject: [PATCH 1/2] Add Referrer field to AuditEntry Signed-off-by: Khanh Ngo Signed-off-by: Khanh Ngo --- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ github/orgs_audit_log.go | 1 + 3 files changed, 19 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index 4cb34b1260..b13ed4083f 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -1454,6 +1454,14 @@ func (a *AuditEntry) GetReadOnly() string { return *a.ReadOnly } +// GetReferrer returns the Referrer field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetReferrer() string { + if a == nil || a.Referrer == nil { + return "" + } + return *a.Referrer +} + // GetRepo returns the Repo field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetRepo() string { if a == nil || a.Repo == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index cdc27ab996..c8bd40b533 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -1731,6 +1731,16 @@ func TestAuditEntry_GetReadOnly(tt *testing.T) { a.GetReadOnly() } +func TestAuditEntry_GetReferrer(tt *testing.T) { + var zeroValue string + a := &AuditEntry{Referrer: &zeroValue} + a.GetReferrer() + a = &AuditEntry{} + a.GetReferrer() + a = nil + a.GetReferrer() +} + func TestAuditEntry_GetRepo(tt *testing.T) { var zeroValue string a := &AuditEntry{Repo: &zeroValue} diff --git a/github/orgs_audit_log.go b/github/orgs_audit_log.go index e3afd3117f..aa3591359e 100644 --- a/github/orgs_audit_log.go +++ b/github/orgs_audit_log.go @@ -95,6 +95,7 @@ type AuditEntry struct { PullRequestURL *string `json:"pull_request_url,omitempty"` ReadOnly *string `json:"read_only,omitempty"` Reasons []*PolicyOverrideReason `json:"reasons,omitempty"` + Referrer *string `json:"referrer,omitempty"` Repo *string `json:"repo,omitempty"` Repository *string `json:"repository,omitempty"` RepositoryPublic *bool `json:"repository_public,omitempty"` From 27a2fa0e3769a1672e6d0fe6a152dc0d9343e19a Mon Sep 17 00:00:00 2001 From: Khanh Ngo Date: Fri, 15 Dec 2023 17:09:02 +0100 Subject: [PATCH 2/2] Add Referrer field to AuditEntry