Skip to content

Commit 44d09ce

Browse files
authored
Fix old_name field in AuditEntry (#2849)
Relates to: #2843.
1 parent c8c34d0 commit 44d09ce

File tree

4 files changed

+47
-22
lines changed

4 files changed

+47
-22
lines changed

github/github-accessors.go

Lines changed: 16 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 17 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/orgs_audit_log.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ type AuditEntry struct {
7878
Message *string `json:"message,omitempty"`
7979
Name *string `json:"name,omitempty"`
8080
OAuthApplicationID *int64 `json:"oauth_application_id,omitempty"`
81-
OldName *string `json:"old_name,omitempty"` // The previous name of the repository, for a name change
8281
OldUser *string `json:"old_user,omitempty"`
8382
OldPermission *string `json:"old_permission,omitempty"` // The permission level for membership changes, for example `admin` or `read`.
8483
OpenSSHPublicKey *string `json:"openssh_public_key,omitempty"`
@@ -122,6 +121,13 @@ type AuditEntry struct {
122121
Visibility *string `json:"visibility,omitempty"` // The repository visibility, for example `public` or `private`.
123122
WorkflowID *int64 `json:"workflow_id,omitempty"`
124123
WorkflowRunID *int64 `json:"workflow_run_id,omitempty"`
124+
125+
Data *AuditEntryData `json:"data,omitempty"`
126+
}
127+
128+
// AuditEntryData represents additional information stuffed into a `data` field.
129+
type AuditEntryData struct {
130+
OldName *string `json:"old_name,omitempty"` // The previous name of the repository, for a name change
125131
}
126132

127133
// GetAuditLog gets the audit-log entries for an organization.

github/orgs_audit_log_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ func TestAuditEntry_Marshal(t *testing.T) {
256256
LimitedAvailability: Bool(false),
257257
Message: String("m"),
258258
Name: String("n"),
259-
OldName: String("on"),
260259
OldPermission: String("op"),
261260
OldUser: String("ou"),
262261
OpenSSHPublicKey: String("osshpk"),
@@ -300,6 +299,9 @@ func TestAuditEntry_Marshal(t *testing.T) {
300299
Visibility: String("v"),
301300
WorkflowID: Int64(1),
302301
WorkflowRunID: Int64(1),
302+
Data: &AuditEntryData{
303+
OldName: String("on"),
304+
},
303305
}
304306

305307
want := `{
@@ -346,7 +348,6 @@ func TestAuditEntry_Marshal(t *testing.T) {
346348
"limited_availability": false,
347349
"message": "m",
348350
"name": "n",
349-
"old_name": "on",
350351
"old_permission": "op",
351352
"old_user": "ou",
352353
"openssh_public_key": "osshpk",
@@ -393,7 +394,10 @@ func TestAuditEntry_Marshal(t *testing.T) {
393394
"user_agent": "ua",
394395
"visibility": "v",
395396
"workflow_id": 1,
396-
"workflow_run_id": 1
397+
"workflow_run_id": 1,
398+
"data": {
399+
"old_name": "on"
400+
}
397401
}`
398402

399403
testJSONMarshal(t, u, want)

0 commit comments

Comments
 (0)