diff --git a/github/github-accessors.go b/github/github-accessors.go index 356487e0e1e..3f665ede5cb 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -1598,6 +1598,14 @@ func (a *AuditEntry) GetWorkflowRunID() int64 { return *a.WorkflowRunID } +// GetOldLogin returns the OldLogin field if it's non-nil, zero value otherwise. +func (a *AuditEntryData) GetOldLogin() string { + if a == nil || a.OldLogin == nil { + return "" + } + return *a.OldLogin +} + // GetOldName returns the OldName field if it's non-nil, zero value otherwise. func (a *AuditEntryData) GetOldName() string { if a == nil || a.OldName == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 40942da40b3..712d8fc94dd 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -1911,6 +1911,16 @@ func TestAuditEntry_GetWorkflowRunID(tt *testing.T) { a.GetWorkflowRunID() } +func TestAuditEntryData_GetOldLogin(tt *testing.T) { + var zeroValue string + a := &AuditEntryData{OldLogin: &zeroValue} + a.GetOldLogin() + a = &AuditEntryData{} + a.GetOldLogin() + a = nil + a.GetOldLogin() +} + func TestAuditEntryData_GetOldName(tt *testing.T) { var zeroValue string a := &AuditEntryData{OldName: &zeroValue} diff --git a/github/orgs_audit_log.go b/github/orgs_audit_log.go index d7de77127c5..4c34445fa1b 100644 --- a/github/orgs_audit_log.go +++ b/github/orgs_audit_log.go @@ -127,7 +127,8 @@ type AuditEntry struct { // AuditEntryData represents additional information stuffed into a `data` field. type AuditEntryData struct { - OldName *string `json:"old_name,omitempty"` // The previous name of the repository, for a name change + OldName *string `json:"old_name,omitempty"` // The previous name of the repository, for a name change + OldLogin *string `json:"old_login,omitempty"` // The previous name of the organization, for a name change } // GetAuditLog gets the audit-log entries for an organization. diff --git a/github/orgs_audit_log_test.go b/github/orgs_audit_log_test.go index 2995de5023c..89cdf46242e 100644 --- a/github/orgs_audit_log_test.go +++ b/github/orgs_audit_log_test.go @@ -300,7 +300,8 @@ func TestAuditEntry_Marshal(t *testing.T) { WorkflowID: Int64(1), WorkflowRunID: Int64(1), Data: &AuditEntryData{ - OldName: String("on"), + OldName: String("on"), + OldLogin: String("ol"), }, } @@ -396,7 +397,8 @@ func TestAuditEntry_Marshal(t *testing.T) { "workflow_id": 1, "workflow_run_id": 1, "data": { - "old_name": "on" + "old_name": "on", + "old_login": "ol" } }`