Skip to content

Commit

Permalink
Add Permission, OldPermission to AuditEntry type (#2670)
Browse files Browse the repository at this point in the history
Fixes: #2669.
  • Loading branch information
Archetypically committed Feb 22, 2023
1 parent b9cb801 commit e7e7149
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
16 changes: 16 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions github/orgs_audit_log.go
Expand Up @@ -63,8 +63,10 @@ type AuditEntry struct {
Message *string `json:"message,omitempty"`
Name *string `json:"name,omitempty"`
OldUser *string `json:"old_user,omitempty"`
OldPermission *string `json:"old_permission,omitempty"` // The permission level for membership changes, for example `admin` or `read`.
OpenSSHPublicKey *string `json:"openssh_public_key,omitempty"`
Org *string `json:"org,omitempty"`
Permission *string `json:"permission,omitempty"` // The permission level for membership changes, for example `admin` or `read`.
PreviousVisibility *string `json:"previous_visibility,omitempty"`
ReadOnly *string `json:"read_only,omitempty"`
Repo *string `json:"repo,omitempty"`
Expand Down
8 changes: 8 additions & 0 deletions github/orgs_audit_log_test.go
Expand Up @@ -34,6 +34,8 @@ func TestOrganizationService_GetAuditLog(t *testing.T) {
"created_at": 1615077308538,
"head_sha": "5acdeadbeef64d1a62388e901e5cdc9358644b37",
"conclusion": "success",
"old_permission": "read",
"permission": "admin",
"actor": "testactor",
"completed_at": "2021-03-07T00:35:08.000Z",
"@timestamp": 1615077308538,
Expand Down Expand Up @@ -80,7 +82,9 @@ func TestOrganizationService_GetAuditLog(t *testing.T) {
HeadBranch: String("master"),
HeadSHA: String("5acdeadbeef64d1a62388e901e5cdc9358644b37"),
Name: String("Code scanning - action"),
OldPermission: String("read"),
Org: String("o"),
Permission: String("admin"),
Repo: String("o/blue-crayon-1"),
StartedAt: &Timestamp{startedAt},
WorkflowID: Int64(123456),
Expand Down Expand Up @@ -199,9 +203,11 @@ func TestAuditEntry_Marshal(t *testing.T) {
LimitedAvailability: Bool(false),
Message: String("m"),
Name: String("n"),
OldPermission: String("op"),
OldUser: String("ou"),
OpenSSHPublicKey: String("osshpk"),
Org: String("o"),
Permission: String("p"),
PreviousVisibility: String("pv"),
ReadOnly: String("ro"),
Repo: String("r"),
Expand Down Expand Up @@ -268,9 +274,11 @@ func TestAuditEntry_Marshal(t *testing.T) {
"limited_availability": false,
"message": "m",
"name": "n",
"old_permission": "op",
"old_user": "ou",
"openssh_public_key": "osshpk",
"org": "o",
"permission": "p",
"previous_visibility": "pv",
"read_only": "ro",
"repo": "r",
Expand Down

0 comments on commit e7e7149

Please sign in to comment.