Repository: google/go-github
Pull request #2786 (2023-05-24 14:20:07)

Add missing fields to AuditEntry
Fixes: #2785.

Adds the following fields to the `AuditEntry` struct and populates them when they exist in a response from the API:

- `ActorIP` - IP of actor (if enabled in GitHub audit logs)
- `ActorLocation` - location of actor (country code etc)
- `HashedToken` - hashed token identifier when an action is performed using an access token
- `JobWorkflowRef` - reference to workflow job when a workflow runs
- `OAuthApplicationID` - OAuth application identifier when an OAuth application performs an action
- `OrgID` - organization numeric ID
- `ProgrammaticAccessType` - type of programmatic access (i.e. via token, cli, oauth app...)
- `PullRequestID` - self-explanatory
- `PullRequestTitle` - self-explanatory
- `PullRequestURL` - self-explanatory
- `Reasons` - Used when a user overrides branch protection, includes info on user's stated reason why
- `RunNumber` - the numerical ID of the workflow run
- `TokenID` - token ID when an action is performed using an access token
- `TokenScopes` - string containing scopes assigned to a token
- `Topic` - topic used in workflow runs
- `UserAgent` - user-agent used in performing an action

patriknordlen: Resolving type-related issues in tests now.
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/google/go-github/pull/2786?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
> Merging [#2786](https://app.codecov.io/gh/google/go-github/pull/2786?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (f740dbf) into [master](https://app.codecov.io/gh/google/go-github/commit/f96b64ece988554ba6444cb305e6db1132a61454?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (f96b64e) will **not change** coverage.
> The diff coverage is `n/a`.

> :exclamation: Current head f740dbf differs from pull request most recent head fe4b0df. Consider uploading reports for the commit fe4b0df to get more accurate results

```diff
@@           Coverage Diff           @@
##           master    #2786   +/-   ##
=======================================
  Coverage   98.06%   98.06%           
=======================================
  Files         132      132           
  Lines       11650    11650           
=======================================
  Hits        11424    11424           
  Misses        154      154           
  Partials       72       72           
```


| [Impacted Files](https://app.codecov.io/gh/google/go-github/pull/2786?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) | Coverage Δ | |
|---|---|---|
| [github/orgs\_audit\_log.go](https://app.codecov.io/gh/google/go-github/pull/2786?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google#diff-Z2l0aHViL29yZ3NfYXVkaXRfbG9nLmdv) | `100.00% <ø> (ø)` | |



Patch:
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 6e5a089c..f310e42a 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -214,6 +214,14 @@ func (a *ActionsVariable) GetVisibility() string {
 	return *a.Visibility
 }
 
+// GetCountryCode returns the CountryCode field if it's non-nil, zero value otherwise.
+func (a *ActorLocation) GetCountryCode() string {
+	if a == nil || a.CountryCode == nil {
+		return ""
+	}
+	return *a.CountryCode
+}
+
 // GetFrom returns the From field if it's non-nil, zero value otherwise.
 func (a *AdminEnforcedChanges) GetFrom() bool {
 	if a == nil || a.From == nil {
@@ -1038,6 +1046,22 @@ func (a *AuditEntry) GetActor() string {
 	return *a.Actor
 }
 
+// GetActorIP returns the ActorIP field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetActorIP() string {
+	if a == nil || a.ActorIP == nil {
+		return ""
+	}
+	return *a.ActorIP
+}
+
+// GetActorLocation returns the ActorLocation field.
+func (a *AuditEntry) GetActorLocation() *ActorLocation {
+	if a == nil {
+		return nil
+	}
+	return a.ActorLocation
+}
+
 // GetBlockedUser returns the BlockedUser field if it's non-nil, zero value otherwise.
 func (a *AuditEntry) GetBlockedUser() string {
 	if a == nil || a.BlockedUser == nil {
@@ -1166,6 +1190,14 @@ func (a *AuditEntry) GetFingerprint() string {
 	return *a.Fingerprint
 }
 
+// GetHashedToken returns the HashedToken field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetHashedToken() string {
+	if a == nil || a.HashedToken == nil {
+		return ""
+	}
+	return *a.HashedToken
+}
+
 // GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise.
 func (a *AuditEntry) GetHeadBranch() string {
 	if a == nil || a.HeadBranch == nil {
@@ -1206,6 +1238,14 @@ func (a *AuditEntry) GetJobName() string {
 	return *a.JobName
 }
 
+// GetJobWorkflowRef returns the JobWorkflowRef field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetJobWorkflowRef() string {
+	if a == nil || a.JobWorkflowRef == nil {
+		return ""
+	}
+	return *a.JobWorkflowRef
+}
+
 // GetLimitedAvailability returns the LimitedAvailability field if it's non-nil, zero value otherwise.
 func (a *AuditEntry) GetLimitedAvailability() bool {
 	if a == nil || a.LimitedAvailability == nil {
@@ -1230,6 +1270,14 @@ func (a *AuditEntry) GetName() string {
 	return *a.Name
 }
 
+// GetOAuthApplicationID returns the OAuthApplicationID field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetOAuthApplicationID() int64 {
+	if a == nil || a.OAuthApplicationID == nil {
+		return 0
+	}
+	return *a.OAuthApplicationID
+}
+
 // GetOldPermission returns the OldPermission field if it's non-nil, zero value otherwise.
 func (a *AuditEntry) GetOldPermission() string {
 	if a == nil || a.OldPermission == nil {
@@ -1254,6 +1302,14 @@ func (a *AuditEntry) GetOpenSSHPublicKey() string {
 	return *a.OpenSSHPublicKey
 }
 
+// GetOperationType returns the OperationType field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetOperationType() string {
+	if a == nil || a.OperationType == nil {
+		return ""
+	}
+	return *a.OperationType
+}
+
 // GetOrg returns the Org field if it's non-nil, zero value otherwise.
 func (a *AuditEntry) GetOrg() string {
 	if a == nil || a.Org == nil {
@@ -1262,6 +1318,14 @@ func (a *AuditEntry) GetOrg() string {
 	return *a.Org
 }
 
+// GetOrgID returns the OrgID field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetOrgID() int64 {
+	if a == nil || a.OrgID == nil {
+		return 0
+	}
+	return *a.OrgID
+}
+
 // GetPermission returns the Permission field if it's non-nil, zero value otherwise.
 func (a *AuditEntry) GetPermission() string {
 	if a == nil || a.Permission == nil {
@@ -1278,6 +1342,38 @@ func (a *AuditEntry) GetPreviousVisibility() string {
 	return *a.PreviousVisibility
 }
 
+// GetProgrammaticAccessType returns the ProgrammaticAccessType field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetProgrammaticAccessType() string {
+	if a == nil || a.ProgrammaticAccessType == nil {
+		return ""
+	}
+	return *a.ProgrammaticAccessType
+}
+
+// GetPullRequestID returns the PullRequestID field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetPullRequestID() int64 {
+	if a == nil || a.PullRequestID == nil {
+		return 0
+	}
+	return *a.PullRequestID
+}
+
+// GetPullRequestTitle returns the PullRequestTitle field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetPullRequestTitle() string {
+	if a == nil || a.PullRequestTitle == nil {
+		return ""
+	}
+	return *a.PullRequestTitle
+}
+
+// GetPullRequestURL returns the PullRequestURL field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetPullRequestURL() string {
+	if a == nil || a.PullRequestURL == nil {
+		return ""
+	}
+	return *a.PullRequestURL
+}
+
 // GetReadOnly returns the ReadOnly field if it's non-nil, zero value otherwise.
 func (a *AuditEntry) GetReadOnly() string {
 	if a == nil || a.ReadOnly == nil {
@@ -1350,6 +1446,14 @@ func (a *AuditEntry) GetRunnerName() string {
 	return *a.RunnerName
 }
 
+// GetRunNumber returns the RunNumber field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetRunNumber() int64 {
+	if a == nil || a.RunNumber == nil {
+		return 0
+	}
+	return *a.RunNumber
+}
+
 // GetSourceVersion returns the SourceVersion field if it's non-nil, zero value otherwise.
 func (a *AuditEntry) GetSourceVersion() string {
 	if a == nil || a.SourceVersion == nil {
@@ -1398,6 +1502,30 @@ func (a *AuditEntry) GetTimestamp() Timestamp {
 	return *a.Timestamp
 }
 
+// GetTokenID returns the TokenID field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetTokenID() int64 {
+	if a == nil || a.TokenID == nil {
+		return 0
+	}
+	return *a.TokenID
+}
+
+// GetTokenScopes returns the TokenScopes field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetTokenScopes() string {
+	if a == nil || a.TokenScopes == nil {
+		return ""
+	}
+	return *a.TokenScopes
+}
+
+// GetTopic returns the Topic field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetTopic() string {
+	if a == nil || a.Topic == nil {
+		return ""
+	}
+	return *a.Topic
+}
+
 // GetTransportProtocol returns the TransportProtocol field if it's non-nil, zero value otherwise.
 func (a *AuditEntry) GetTransportProtocol() int {
 	if a == nil || a.TransportProtocol == nil {
@@ -1430,6 +1558,14 @@ func (a *AuditEntry) GetUser() string {
 	return *a.User
 }
 
+// GetUserAgent returns the UserAgent field if it's non-nil, zero value otherwise.
+func (a *AuditEntry) GetUserAgent() string {
+	if a == nil || a.UserAgent == nil {
+		return ""
+	}
+	return *a.UserAgent
+}
+
 // GetVisibility returns the Visibility field if it's non-nil, zero value otherwise.
 func (a *AuditEntry) GetVisibility() string {
 	if a == nil || a.Visibility == nil {
@@ -12614,6 +12750,22 @@ func (p *Plan) GetSpace() int {
 	return *p.Space
 }
 
+// GetCode returns the Code field if it's non-nil, zero value otherwise.
+func (p *PolicyOverrideReason) GetCode() string {
+	if p == nil || p.Code == nil {
+		return ""
+	}
+	return *p.Code
+}
+
+// GetMessage returns the Message field if it's non-nil, zero value otherwise.
+func (p *PolicyOverrideReason) GetMessage() string {
+	if p == nil || p.Message == nil {
+		return ""
+	}
+	return *p.Message
+}
+
 // GetConfigURL returns the ConfigURL field if it's non-nil, zero value otherwise.
 func (p *PreReceiveHook) GetConfigURL() string {
 	if p == nil || p.ConfigURL == nil {
diff --git a/github/orgs_audit_log.go b/github/orgs_audit_log.go
index 700c233c..e2e4692e 100644
--- a/github/orgs_audit_log.go
+++ b/github/orgs_audit_log.go
@@ -29,69 +29,98 @@ type HookConfig struct {
 	Secret *string `json:"secret,omitempty"`
 }
 
+// ActorLocation contains information about reported location for an actor.
+type ActorLocation struct {
+	CountryCode *string `json:"country_code,omitempty"`
+}
+
+// PolicyOverrideReason contains user-supplied information about why a policy was overridden.
+type PolicyOverrideReason struct {
+	Code    *string `json:"code,omitempty"`
+	Message *string `json:"message,omitempty"`
+}
+
 // AuditEntry describes the fields that may be represented by various audit-log "action" entries.
 // For a list of actions see - https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#audit-log-actions
 type AuditEntry struct {
-	Action                *string     `json:"action,omitempty"` // The name of the action that was performed, for example `user.login` or `repo.create`.
-	Active                *bool       `json:"active,omitempty"`
-	ActiveWas             *bool       `json:"active_was,omitempty"`
-	Actor                 *string     `json:"actor,omitempty"` // The actor who performed the action.
-	BlockedUser           *string     `json:"blocked_user,omitempty"`
-	Business              *string     `json:"business,omitempty"`
-	CancelledAt           *Timestamp  `json:"cancelled_at,omitempty"`
-	CompletedAt           *Timestamp  `json:"completed_at,omitempty"`
-	Conclusion            *string     `json:"conclusion,omitempty"`
-	Config                *HookConfig `json:"config,omitempty"`
-	ConfigWas             *HookConfig `json:"config_was,omitempty"`
-	ContentType           *string     `json:"content_type,omitempty"`
-	CreatedAt             *Timestamp  `json:"created_at,omitempty"`
-	DeployKeyFingerprint  *string     `json:"deploy_key_fingerprint,omitempty"`
-	DocumentID            *string     `json:"_document_id,omitempty"`
-	Emoji                 *string     `json:"emoji,omitempty"`
-	EnvironmentName       *string     `json:"environment_name,omitempty"`
-	Event                 *string     `json:"event,omitempty"`
-	Events                []string    `json:"events,omitempty"`
-	EventsWere            []string    `json:"events_were,omitempty"`
-	Explanation           *string     `json:"explanation,omitempty"`
-	Fingerprint           *string     `json:"fingerprint,omitempty"`
-	HeadBranch            *string     `json:"head_branch,omitempty"`
-	HeadSHA               *string     `json:"head_sha,omitempty"`
-	HookID                *int64      `json:"hook_id,omitempty"`
-	IsHostedRunner        *bool       `json:"is_hosted_runner,omitempty"`
-	JobName               *string     `json:"job_name,omitempty"`
-	LimitedAvailability   *bool       `json:"limited_availability,omitempty"`
-	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"`
-	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"`
-	RunnerLabels          []string    `json:"runner_labels,omitempty"`
-	RunnerName            *string     `json:"runner_name,omitempty"`
-	SecretsPassed         []string    `json:"secrets_passed,omitempty"`
-	SourceVersion         *string     `json:"source_version,omitempty"`
-	StartedAt             *Timestamp  `json:"started_at,omitempty"`
-	TargetLogin           *string     `json:"target_login,omitempty"`
-	TargetVersion         *string     `json:"target_version,omitempty"`
-	Team                  *string     `json:"team,omitempty"`
-	Timestamp             *Timestamp  `json:"@timestamp,omitempty"`              // The time the audit log event occurred, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time).
-	TransportProtocolName *string     `json:"transport_protocol_name,omitempty"` // A human readable name for the protocol (for example, HTTP or SSH) used to transfer Git data.
-	TransportProtocol     *int        `json:"transport_protocol,omitempty"`      // The type of protocol (for example, HTTP=1 or SSH=2) used to transfer Git data.
-	TriggerID             *int64      `json:"trigger_id,omitempty"`
-	User                  *string     `json:"user,omitempty"`       // The user that was affected by the action performed (if available).
-	Visibility            *string     `json:"visibility,omitempty"` // The repository visibility, for example `public` or `private`.
-	WorkflowID            *int64      `json:"workflow_id,omitempty"`
-	WorkflowRunID         *int64      `json:"workflow_run_id,omitempty"`
+	ActorIP                *string                 `json:"actor_ip,omitempty"`
+	Action                 *string                 `json:"action,omitempty"` // The name of the action that was performed, for example `user.login` or `repo.create`.
+	Active                 *bool                   `json:"active,omitempty"`
+	ActiveWas              *bool                   `json:"active_was,omitempty"`
+	Actor                  *string                 `json:"actor,omitempty"` // The actor who performed the action.
+	ActorLocation          *ActorLocation          `json:"actor_location,omitempty"`
+	BlockedUser            *string                 `json:"blocked_user,omitempty"`
+	Business               *string                 `json:"business,omitempty"`
+	CancelledAt            *Timestamp              `json:"cancelled_at,omitempty"`
+	CompletedAt            *Timestamp              `json:"completed_at,omitempty"`
+	Conclusion             *string                 `json:"conclusion,omitempty"`
+	Config                 *HookConfig             `json:"config,omitempty"`
+	ConfigWas              *HookConfig             `json:"config_was,omitempty"`
+	ContentType            *string                 `json:"content_type,omitempty"`
+	CreatedAt              *Timestamp              `json:"created_at,omitempty"`
+	DeployKeyFingerprint   *string                 `json:"deploy_key_fingerprint,omitempty"`
+	DocumentID             *string                 `json:"_document_id,omitempty"`
+	Emoji                  *string                 `json:"emoji,omitempty"`
+	EnvironmentName        *string                 `json:"environment_name,omitempty"`
+	Event                  *string                 `json:"event,omitempty"`
+	Events                 []string                `json:"events,omitempty"`
+	EventsWere             []string                `json:"events_were,omitempty"`
+	Explanation            *string                 `json:"explanation,omitempty"`
+	Fingerprint            *string                 `json:"fingerprint,omitempty"`
+	HashedToken            *string                 `json:"hashed_token,omitempty"`
+	HeadBranch             *string                 `json:"head_branch,omitempty"`
+	HeadSHA                *string                 `json:"head_sha,omitempty"`
+	HookID                 *int64                  `json:"hook_id,omitempty"`
+	IsHostedRunner         *bool                   `json:"is_hosted_runner,omitempty"`
+	JobName                *string                 `json:"job_name,omitempty"`
+	JobWorkflowRef         *string                 `json:"job_workflow_ref,omitempty"`
+	LimitedAvailability    *bool                   `json:"limited_availability,omitempty"`
+	Message                *string                 `json:"message,omitempty"`
+	Name                   *string                 `json:"name,omitempty"`
+	OAuthApplicationID     *int64                  `json:"oauth_application_id,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"`
+	OperationType          *string                 `json:"operation_type,omitempty"`
+	Org                    *string                 `json:"org,omitempty"`
+	OrgID                  *int64                  `json:"org_id,omitempty"`
+	OverriddenCodes        []string                `json:"overridden_codes,omitempty"`
+	Permission             *string                 `json:"permission,omitempty"` // The permission level for membership changes, for example `admin` or `read`.
+	PreviousVisibility     *string                 `json:"previous_visibility,omitempty"`
+	ProgrammaticAccessType *string                 `json:"programmatic_access_type,omitempty"`
+	PullRequestID          *int64                  `json:"pull_request_id,omitempty"`
+	PullRequestTitle       *string                 `json:"pull_request_title,omitempty"`
+	PullRequestURL         *string                 `json:"pull_request_url,omitempty"`
+	ReadOnly               *string                 `json:"read_only,omitempty"`
+	Reasons                []*PolicyOverrideReason `json:"reasons,omitempty"`
+	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"`
+	RunnerLabels           []string                `json:"runner_labels,omitempty"`
+	RunnerName             *string                 `json:"runner_name,omitempty"`
+	RunNumber              *int64                  `json:"run_number,omitempty"`
+	SecretsPassed          []string                `json:"secrets_passed,omitempty"`
+	SourceVersion          *string                 `json:"source_version,omitempty"`
+	StartedAt              *Timestamp              `json:"started_at,omitempty"`
+	TargetLogin            *string                 `json:"target_login,omitempty"`
+	TargetVersion          *string                 `json:"target_version,omitempty"`
+	Team                   *string                 `json:"team,omitempty"`
+	Timestamp              *Timestamp              `json:"@timestamp,omitempty"` // The time the audit log event occurred, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time).
+	TokenID                *int64                  `json:"token_id,omitempty"`
+	TokenScopes            *string                 `json:"token_scopes,omitempty"`
+	Topic                  *string                 `json:"topic,omitempty"`
+	TransportProtocolName  *string                 `json:"transport_protocol_name,omitempty"` // A human readable name for the protocol (for example, HTTP or SSH) used to transfer Git data.
+	TransportProtocol      *int                    `json:"transport_protocol,omitempty"`      // The type of protocol (for example, HTTP=1 or SSH=2) used to transfer Git data.
+	TriggerID              *int64                  `json:"trigger_id,omitempty"`
+	User                   *string                 `json:"user,omitempty"` // The user that was affected by the action performed (if available).
+	UserAgent              *string                 `json:"user_agent,omitempty"`
+	Visibility             *string                 `json:"visibility,omitempty"` // The repository visibility, for example `public` or `private`.
+	WorkflowID             *int64                  `json:"workflow_id,omitempty"`
+	WorkflowRunID          *int64                  `json:"workflow_run_id,omitempty"`
 }
 
 // GetAuditLog gets the audit-log entries for an organization.


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 8d6c6a4d..97f3994f 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -262,6 +262,16 @@ func TestActionsVariable_GetVisibility(tt *testing.T) {
 	a.GetVisibility()
 }
 
+func TestActorLocation_GetCountryCode(tt *testing.T) {
+	var zeroValue string
+	a := &ActorLocation{CountryCode: &zeroValue}
+	a.GetCountryCode()
+	a = &ActorLocation{}
+	a.GetCountryCode()
+	a = nil
+	a.GetCountryCode()
+}
+
 func TestAdminEnforcedChanges_GetFrom(tt *testing.T) {
 	var zeroValue bool
 	a := &AdminEnforcedChanges{From: &zeroValue}
@@ -1223,6 +1233,23 @@ func TestAuditEntry_GetActor(tt *testing.T) {
 	a.GetActor()
 }
 
+func TestAuditEntry_GetActorIP(tt *testing.T) {
+	var zeroValue string
+	a := &AuditEntry{ActorIP: &zeroValue}
+	a.GetActorIP()
+	a = &AuditEntry{}
+	a.GetActorIP()
+	a = nil
+	a.GetActorIP()
+}
+
+func TestAuditEntry_GetActorLocation(tt *testing.T) {
+	a := &AuditEntry{}
+	a.GetActorLocation()
+	a = nil
+	a.GetActorLocation()
+}
+
 func TestAuditEntry_GetBlockedUser(tt *testing.T) {
 	var zeroValue string
 	a := &AuditEntry{BlockedUser: &zeroValue}
@@ -1377,6 +1404,16 @@ func TestAuditEntry_GetFingerprint(tt *testing.T) {
 	a.GetFingerprint()
 }
 
+func TestAuditEntry_GetHashedToken(tt *testing.T) {
+	var zeroValue string
+	a := &AuditEntry{HashedToken: &zeroValue}
+	a.GetHashedToken()
+	a = &AuditEntry{}
+	a.GetHashedToken()
+	a = nil
+	a.GetHashedToken()
+}
+
 func TestAuditEntry_GetHeadBranch(tt *testing.T) {
 	var zeroValue string
 	a := &AuditEntry{HeadBranch: &zeroValue}
@@ -1427,6 +1464,16 @@ func TestAuditEntry_GetJobName(tt *testing.T) {
 	a.GetJobName()
 }
 
+func TestAuditEntry_GetJobWorkflowRef(tt *testing.T) {
+	var zeroValue string
+	a := &AuditEntry{JobWorkflowRef: &zeroValue}
+	a.GetJobWorkflowRef()
+	a = &AuditEntry{}
+	a.GetJobWorkflowRef()
+	a = nil
+	a.GetJobWorkflowRef()
+}
+
 func TestAuditEntry_GetLimitedAvailability(tt *testing.T) {
 	var zeroValue bool
 	a := &AuditEntry{LimitedAvailability: &zeroValue}
@@ -1457,6 +1504,16 @@ func TestAuditEntry_GetName(tt *testing.T) {
 	a.GetName()
 }
 
+func TestAuditEntry_GetOAuthApplicationID(tt *testing.T) {
+	var zeroValue int64
+	a := &AuditEntry{OAuthApplicationID: &zeroValue}
+	a.GetOAuthApplicationID()
+	a = &AuditEntry{}
+	a.GetOAuthApplicationID()
+	a = nil
+	a.GetOAuthApplicationID()
+}
+
 func TestAuditEntry_GetOldPermission(tt *testing.T) {
 	var zeroValue string
 	a := &AuditEntry{OldPermission: &zeroValue}
@@ -1487,6 +1544,16 @@ func TestAuditEntry_GetOpenSSHPublicKey(tt *testing.T) {
 	a.GetOpenSSHPublicKey()
 }
 
+func TestAuditEntry_GetOperationType(tt *testing.T) {
+	var zeroValue string
+	a := &AuditEntry{OperationType: &zeroValue}
+	a.GetOperationType()
+	a = &AuditEntry{}
+	a.GetOperationType()
+	a = nil
+	a.GetOperationType()
+}
+
 func TestAuditEntry_GetOrg(tt *testing.T) {
 	var zeroValue string
 	a := &AuditEntry{Org: &zeroValue}
@@ -1497,6 +1564,16 @@ func TestAuditEntry_GetOrg(tt *testing.T) {
 	a.GetOrg()
 }
 
+func TestAuditEntry_GetOrgID(tt *testing.T) {
+	var zeroValue int64
+	a := &AuditEntry{OrgID: &zeroValue}
+	a.GetOrgID()
+	a = &AuditEntry{}
+	a.GetOrgID()
+	a = nil
+	a.GetOrgID()
+}
+
 func TestAuditEntry_GetPermission(tt *testing.T) {
 	var zeroValue string
 	a := &AuditEntry{Permission: &zeroValue}
@@ -1517,6 +1594,46 @@ func TestAuditEntry_GetPreviousVisibility(tt *testing.T) {
 	a.GetPreviousVisibility()
 }
 
+func TestAuditEntry_GetProgrammaticAccessType(tt *testing.T) {
+	var zeroValue string
+	a := &AuditEntry{ProgrammaticAccessType: &zeroValue}
+	a.GetProgrammaticAccessType()
+	a = &AuditEntry{}
+	a.GetProgrammaticAccessType()
+	a = nil
+	a.GetProgrammaticAccessType()
+}
+
+func TestAuditEntry_GetPullRequestID(tt *testing.T) {
+	var zeroValue int64
+	a := &AuditEntry{PullRequestID: &zeroValue}
+	a.GetPullRequestID()
+	a = &AuditEntry{}
+	a.GetPullRequestID()
+	a = nil
+	a.GetPullRequestID()
+}
+
+func TestAuditEntry_GetPullRequestTitle(tt *testing.T) {
+	var zeroValue string
+	a := &AuditEntry{PullRequestTitle: &zeroValue}
+	a.GetPullRequestTitle()
+	a = &AuditEntry{}
+	a.GetPullRequestTitle()
+	a = nil
+	a.GetPullRequestTitle()
+}
+
+func TestAuditEntry_GetPullRequestURL(tt *testing.T) {
+	var zeroValue string
+	a := &AuditEntry{PullRequestURL: &zeroValue}
+	a.GetPullRequestURL()
+	a = &AuditEntry{}
+	a.GetPullRequestURL()
+	a = nil
+	a.GetPullRequestURL()
+}
+
 func TestAuditEntry_GetReadOnly(tt *testing.T) {
 	var zeroValue string
 	a := &AuditEntry{ReadOnly: &zeroValue}
@@ -1607,6 +1724,16 @@ func TestAuditEntry_GetRunnerName(tt *testing.T) {
 	a.GetRunnerName()
 }
 
+func TestAuditEntry_GetRunNumber(tt *testing.T) {
+	var zeroValue int64
+	a := &AuditEntry{RunNumber: &zeroValue}
+	a.GetRunNumber()
+	a = &AuditEntry{}
+	a.GetRunNumber()
+	a = nil
+	a.GetRunNumber()
+}
+
 func TestAuditEntry_GetSourceVersion(tt *testing.T) {
 	var zeroValue string
 	a := &AuditEntry{SourceVersion: &zeroValue}
@@ -1667,6 +1794,36 @@ func TestAuditEntry_GetTimestamp(tt *testing.T) {
 	a.GetTimestamp()
 }
 
+func TestAuditEntry_GetTokenID(tt *testing.T) {
+	var zeroValue int64
+	a := &AuditEntry{TokenID: &zeroValue}
+	a.GetTokenID()
+	a = &AuditEntry{}
+	a.GetTokenID()
+	a = nil
+	a.GetTokenID()
+}
+
+func TestAuditEntry_GetTokenScopes(tt *testing.T) {
+	var zeroValue string
+	a := &AuditEntry{TokenScopes: &zeroValue}
+	a.GetTokenScopes()
+	a = &AuditEntry{}
+	a.GetTokenScopes()
+	a = nil
+	a.GetTokenScopes()
+}
+
+func TestAuditEntry_GetTopic(tt *testing.T) {
+	var zeroValue string
+	a := &AuditEntry{Topic: &zeroValue}
+	a.GetTopic()
+	a = &AuditEntry{}
+	a.GetTopic()
+	a = nil
+	a.GetTopic()
+}
+
 func TestAuditEntry_GetTransportProtocol(tt *testing.T) {
 	var zeroValue int
 	a := &AuditEntry{TransportProtocol: &zeroValue}
@@ -1707,6 +1864,16 @@ func TestAuditEntry_GetUser(tt *testing.T) {
 	a.GetUser()
 }
 
+func TestAuditEntry_GetUserAgent(tt *testing.T) {
+	var zeroValue string
+	a := &AuditEntry{UserAgent: &zeroValue}
+	a.GetUserAgent()
+	a = &AuditEntry{}
+	a.GetUserAgent()
+	a = nil
+	a.GetUserAgent()
+}
+
 func TestAuditEntry_GetVisibility(tt *testing.T) {
 	var zeroValue string
 	a := &AuditEntry{Visibility: &zeroValue}
@@ -14781,6 +14948,26 @@ func TestPlan_GetSpace(tt *testing.T) {
 	p.GetSpace()
 }
 
+func TestPolicyOverrideReason_GetCode(tt *testing.T) {
+	var zeroValue string
+	p := &PolicyOverrideReason{Code: &zeroValue}
+	p.GetCode()
+	p = &PolicyOverrideReason{}
+	p.GetCode()
+	p = nil
+	p.GetCode()
+}
+
+func TestPolicyOverrideReason_GetMessage(tt *testing.T) {
+	var zeroValue string
+	p := &PolicyOverrideReason{Message: &zeroValue}
+	p.GetMessage()
+	p = &PolicyOverrideReason{}
+	p.GetMessage()
+	p = nil
+	p.GetMessage()
+}
+
 func TestPreReceiveHook_GetConfigURL(tt *testing.T) {
 	var zeroValue string
 	p := &PreReceiveHook{ConfigURL: &zeroValue}
diff --git a/github/orgs_audit_log_test.go b/github/orgs_audit_log_test.go
index be636156..8d33a986 100644
--- a/github/orgs_audit_log_test.go
+++ b/github/orgs_audit_log_test.go
@@ -25,6 +25,10 @@ func TestOrganizationService_GetAuditLog(t *testing.T) {
 
 		fmt.Fprint(w, `[
 		{
+		"actor_ip": "10.0.0.1",
+		"actor_location": {
+			"country_code": "US"
+		},
         "active": true,
         "workflow_id": 123456,
         "head_branch": "master",
@@ -32,6 +36,7 @@ func TestOrganizationService_GetAuditLog(t *testing.T) {
         "trigger_id": null,
         "repo": "o/blue-crayon-1",
         "created_at": 1615077308538,
+		"hashed_token": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
         "head_sha": "5acdeadbeef64d1a62388e901e5cdc9358644b37",
         "conclusion": "success",
         "old_permission": "read",
@@ -45,6 +50,28 @@ func TestOrganizationService_GetAuditLog(t *testing.T) {
         "event": "schedule",
         "workflow_run_id": 628312345,
         "_document_id": "beeZYapIUe-wKg5-beadb33",
+		"run_attempt": 1,
+		"run_number": 1,
+		"token_id": 1,
+		"token_scopes": "gist,repo:read",
+		"topic": "cp1-iad.ingest.github.actions.v0.WorkflowUpdate",
+		"job_workflow_ref": "testorg/testrepo/.github/workflows/testjob.yml@refs/pull/1/merge",
+		"oauth_application_id": 1,
+		"org_id": 1,
+		"pull_request_id": 1,
+		"pull_request_title": "a pr title",
+		"pull_request_url": "https://github.com/testorg/testrepo/pull/1",
+		"overridden_codes": [
+			"review_policy_not_satisfied"
+		],
+		"reasons": [
+			{
+				"code": "a code",
+				"message": "a message"
+			}
+		],
+		"programmatic_access_type": "GitHub App server-to-server token",
+		"user_agent": "a user agent",
         "config": {
             "content_type": "json",
             "insecure_ssl": "0",
@@ -70,23 +97,46 @@ func TestOrganizationService_GetAuditLog(t *testing.T) {
 
 	want := []*AuditEntry{
 		{
-			Timestamp:     &Timestamp{timestamp},
-			DocumentID:    String("beeZYapIUe-wKg5-beadb33"),
-			Action:        String("workflows.completed_workflow_run"),
-			Actor:         String("testactor"),
-			Active:        Bool(true),
-			CompletedAt:   &Timestamp{completedAt},
-			Conclusion:    String("success"),
-			CreatedAt:     &Timestamp{timestamp},
-			Event:         String("schedule"),
-			HeadBranch:    String("master"),
-			HeadSHA:       String("5acdeadbeef64d1a62388e901e5cdc9358644b37"),
-			Name:          String("Code scanning - action"),
-			OldPermission: String("read"),
-			Org:           String("o"),
-			Permission:    String("admin"),
+			Timestamp:  &Timestamp{timestamp},
+			DocumentID: String("beeZYapIUe-wKg5-beadb33"),
+			Action:     String("workflows.completed_workflow_run"),
+			Actor:      String("testactor"),
+			ActorIP:    String("10.0.0.1"),
+			ActorLocation: &ActorLocation{
+				CountryCode: String("US"),
+			},
+			Active:                 Bool(true),
+			CompletedAt:            &Timestamp{completedAt},
+			Conclusion:             String("success"),
+			CreatedAt:              &Timestamp{timestamp},
+			Event:                  String("schedule"),
+			HashedToken:            String("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="),
+			HeadBranch:             String("master"),
+			HeadSHA:                String("5acdeadbeef64d1a62388e901e5cdc9358644b37"),
+			JobWorkflowRef:         String("testorg/testrepo/.github/workflows/testjob.yml@refs/pull/1/merge"),
+			Name:                   String("Code scanning - action"),
+			OAuthApplicationID:     Int64(1),
+			OldPermission:          String("read"),
+			Org:                    String("o"),
+			OrgID:                  Int64(1),
+			OverriddenCodes:        []string{"review_policy_not_satisfied"},
+			Permission:             String("admin"),
+			ProgrammaticAccessType: String("GitHub App server-to-server token"),
+			PullRequestID:          Int64(1),
+			PullRequestTitle:       String("a pr title"),
+			PullRequestURL:         String("https://github.com/testorg/testrepo/pull/1"),
+			Reasons: []*PolicyOverrideReason{{
+				Code:    String("a code"),
+				Message: String("a message"),
+			}},
 			Repo:          String("o/blue-crayon-1"),
+			RunAttempt:    Int64(1),
+			RunNumber:     Int64(1),
 			StartedAt:     &Timestamp{startedAt},
+			TokenID:       Int64(1),
+			TokenScopes:   String("gist,repo:read"),
+			Topic:         String("cp1-iad.ingest.github.actions.v0.WorkflowUpdate"),
+			UserAgent:     String("a user agent"),
 			WorkflowID:    Int64(123456),
 			WorkflowRunID: Int64(628312345),
 			Events:        []string{"code_scanning_alert"},
@@ -173,42 +223,54 @@ func TestAuditEntry_Marshal(t *testing.T) {
 	testJSONMarshal(t, &AuditEntry{}, "{}")
 
 	u := &AuditEntry{
-		Action:                String("a"),
-		Active:                Bool(false),
-		ActiveWas:             Bool(false),
-		Actor:                 String("ac"),
-		BlockedUser:           String("bu"),
-		Business:              String("b"),
-		CancelledAt:           &Timestamp{referenceTime},
-		CompletedAt:           &Timestamp{referenceTime},
-		Conclusion:            String("c"),
-		Config:                &HookConfig{URL: String("s")},
-		ConfigWas:             &HookConfig{URL: String("s")},
-		ContentType:           String("ct"),
-		CreatedAt:             &Timestamp{referenceTime},
-		DeployKeyFingerprint:  String("dkf"),
-		DocumentID:            String("did"),
-		Emoji:                 String("e"),
-		EnvironmentName:       String("en"),
-		Event:                 String("e"),
-		Events:                []string{"s"},
-		EventsWere:            []string{"s"},
-		Explanation:           String("e"),
-		Fingerprint:           String("f"),
-		HeadBranch:            String("hb"),
-		HeadSHA:               String("hsha"),
-		HookID:                Int64(1),
-		IsHostedRunner:        Bool(false),
-		JobName:               String("jn"),
-		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"),
+		Action:                 String("a"),
+		Active:                 Bool(false),
+		ActiveWas:              Bool(false),
+		Actor:                  String("ac"),
+		ActorIP:                String("aip"),
+		ActorLocation:          &ActorLocation{CountryCode: String("alcc")},
+		BlockedUser:            String("bu"),
+		Business:               String("b"),
+		CancelledAt:            &Timestamp{referenceTime},
+		CompletedAt:            &Timestamp{referenceTime},
+		Conclusion:             String("c"),
+		Config:                 &HookConfig{URL: String("s")},
+		ConfigWas:              &HookConfig{URL: String("s")},
+		ContentType:            String("ct"),
+		CreatedAt:              &Timestamp{referenceTime},
+		DeployKeyFingerprint:   String("dkf"),
+		DocumentID:             String("did"),
+		Emoji:                  String("e"),
+		EnvironmentName:        String("en"),
+		Event:                  String("e"),
+		Events:                 []string{"s"},
+		EventsWere:             []string{"s"},
+		Explanation:            String("e"),
+		Fingerprint:            String("f"),
+		HashedToken:            String("ht"),
+		HeadBranch:             String("hb"),
+		HeadSHA:                String("hsha"),
+		HookID:                 Int64(1),
+		IsHostedRunner:         Bool(false),
+		JobName:                String("jn"),
+		LimitedAvailability:    Bool(false),
+		Message:                String("m"),
+		Name:                   String("n"),
+		OldPermission:          String("op"),
+		OldUser:                String("ou"),
+		OpenSSHPublicKey:       String("osshpk"),
+		Org:                    String("o"),
+		OrgID:                  Int64(1),
+		Permission:             String("p"),
+		PreviousVisibility:     String("pv"),
+		ProgrammaticAccessType: String("pat"),
+		PullRequestID:          Int64(1),
+		PullRequestTitle:       String("prt"),
+		PullRequestURL:         String("pru"),
+		Reasons: []*PolicyOverrideReason{{
+			Code:    String("c"),
+			Message: String("m"),
+		}},
 		ReadOnly:              String("ro"),
 		Repo:                  String("r"),
 		Repository:            String("repo"),
@@ -226,10 +288,14 @@ func TestAuditEntry_Marshal(t *testing.T) {
 		TargetVersion:         String("tv"),
 		Team:                  String("t"),
 		Timestamp:             &Timestamp{referenceTime},
+		TokenID:               Int64(1),
+		TokenScopes:           String("ts"),
+		Topic:                 String("tp"),
 		TransportProtocolName: String("tpn"),
 		TransportProtocol:     Int(1),
 		TriggerID:             Int64(1),
 		User:                  String("u"),
+		UserAgent:             String("ua"),
 		Visibility:            String("v"),
 		WorkflowID:            Int64(1),
 		WorkflowRunID:         Int64(1),
@@ -240,6 +306,10 @@ func TestAuditEntry_Marshal(t *testing.T) {
 		"active": false,
 		"active_was": false,
 		"actor": "ac",
+		"actor_ip": "aip",
+		"actor_location": {
+			"country_code": "alcc"
+		},
 		"blocked_user": "bu",
 		"business": "b",
 		"cancelled_at": ` + referenceTimeStr + `,
@@ -266,6 +336,7 @@ func TestAuditEntry_Marshal(t *testing.T) {
 		],
 		"explanation": "e",
 		"fingerprint": "f",
+		"hashed_token": "ht",
 		"head_branch": "hb",
 		"head_sha": "hsha",
 		"hook_id": 1,
@@ -278,8 +349,17 @@ func TestAuditEntry_Marshal(t *testing.T) {
 		"old_user": "ou",
 		"openssh_public_key": "osshpk",
 		"org": "o",
+		"org_id": 1,
 		"permission": "p",
 		"previous_visibility": "pv",
+		"programmatic_access_type": "pat",
+		"pull_request_id": 1,
+		"pull_request_title": "prt",
+		"pull_request_url": "pru",
+		"reasons": [{
+			"code": "c",
+			"message": "m"
+		}],
 		"read_only": "ro",
 		"repo": "r",
 		"repository": "repo",
@@ -301,10 +381,14 @@ func TestAuditEntry_Marshal(t *testing.T) {
 		"target_version": "tv",
 		"team": "t",
 		"@timestamp": ` + referenceTimeStr + `,
+		"token_id": 1,
+		"token_scopes": "ts",
+		"topic": "tp",
 		"transport_protocol_name": "tpn",
 		"transport_protocol": 1,
 		"trigger_id": 1,
 		"user": "u",
+		"user_agent": "ua",
 		"visibility": "v",
 		"workflow_id": 1,
 		"workflow_run_id": 1