From 583f6f74c2c86f291dd2c5732116f1b9d5b43d40 Mon Sep 17 00:00:00 2001 From: JamBalaya56562 Date: Tue, 13 Oct 2026 20:50:32 +0900 Subject: [PATCH 1/3] feat: Add missing fields to `Alert` and `DependabotAlert` --- github/code_scanning.go | 47 ++++++++------- github/dependabot_alerts.go | 41 ++++++++----- github/github-accessors.go | 80 +++++++++++++++++++++++++ github/github-accessors_test.go | 101 ++++++++++++++++++++++++++++++++ 4 files changed, 232 insertions(+), 37 deletions(-) diff --git a/github/code_scanning.go b/github/code_scanning.go index 36f42357733..8d7e6b56f22 100644 --- a/github/code_scanning.go +++ b/github/code_scanning.go @@ -71,28 +71,31 @@ type Tool struct { // // GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type Alert struct { - Number *int `json:"number,omitempty"` - Repository *Repository `json:"repository,omitempty"` - RuleID *string `json:"rule_id,omitempty"` - RuleSeverity *string `json:"rule_severity,omitempty"` - RuleDescription *string `json:"rule_description,omitempty"` - Rule *Rule `json:"rule,omitempty"` - Tool *Tool `json:"tool,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - FixedAt *Timestamp `json:"fixed_at,omitempty"` - State *string `json:"state,omitempty"` - ClosedBy *User `json:"closed_by,omitempty"` - ClosedAt *Timestamp `json:"closed_at,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - MostRecentInstance *MostRecentInstance `json:"most_recent_instance,omitempty"` - Instances []*MostRecentInstance `json:"instances,omitempty"` - DismissedBy *User `json:"dismissed_by,omitempty"` - DismissedAt *Timestamp `json:"dismissed_at,omitempty"` - DismissedReason *string `json:"dismissed_reason,omitempty"` - DismissedComment *string `json:"dismissed_comment,omitempty"` - InstancesURL *string `json:"instances_url,omitempty"` + Number *int `json:"number,omitempty"` + Repository *Repository `json:"repository,omitempty"` + RuleID *string `json:"rule_id,omitempty"` + RuleSeverity *string `json:"rule_severity,omitempty"` + RuleDescription *string `json:"rule_description,omitempty"` + Rule *Rule `json:"rule,omitempty"` + Tool *Tool `json:"tool,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + FixedAt *Timestamp `json:"fixed_at,omitempty"` + State *string `json:"state,omitempty"` + ClosedBy *User `json:"closed_by,omitempty"` + ClosedAt *Timestamp `json:"closed_at,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + MostRecentInstance *MostRecentInstance `json:"most_recent_instance,omitempty"` + Instances []*MostRecentInstance `json:"instances,omitempty"` + DismissedBy *User `json:"dismissed_by,omitempty"` + DismissedAt *Timestamp `json:"dismissed_at,omitempty"` + DismissedReason *string `json:"dismissed_reason,omitempty"` + DismissedComment *string `json:"dismissed_comment,omitempty"` + DismissalApprovedBy *User `json:"dismissal_approved_by,omitempty"` + InstancesURL *string `json:"instances_url,omitempty"` + Assignees []*User `json:"assignees,omitempty"` + LinkedPullRequests []*PullRequest `json:"linked_pull_requests,omitempty"` } // ID returns the ID associated with an alert. It is the number at the end of the security alert's URL. diff --git a/github/dependabot_alerts.go b/github/dependabot_alerts.go index 6cc37b2c367..4713b3424bb 100644 --- a/github/dependabot_alerts.go +++ b/github/dependabot_alerts.go @@ -67,25 +67,36 @@ type DependabotSecurityAdvisory struct { // DependabotAlert represents a Dependabot alert. type DependabotAlert struct { - Number *int `json:"number,omitempty"` - State *string `json:"state,omitempty"` - Dependency *Dependency `json:"dependency,omitempty"` - SecurityAdvisory *DependabotSecurityAdvisory `json:"security_advisory,omitempty"` - SecurityVulnerability *AdvisoryVulnerability `json:"security_vulnerability,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - DismissedAt *Timestamp `json:"dismissed_at,omitempty"` - DismissedBy *User `json:"dismissed_by,omitempty"` - DismissedReason *string `json:"dismissed_reason,omitempty"` - DismissedComment *string `json:"dismissed_comment,omitempty"` - FixedAt *Timestamp `json:"fixed_at,omitempty"` - AutoDismissedAt *Timestamp `json:"auto_dismissed_at,omitempty"` + Number *int `json:"number,omitempty"` + State *string `json:"state,omitempty"` + Dependency *Dependency `json:"dependency,omitempty"` + SecurityAdvisory *DependabotSecurityAdvisory `json:"security_advisory,omitempty"` + SecurityVulnerability *AdvisoryVulnerability `json:"security_vulnerability,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + DismissedAt *Timestamp `json:"dismissed_at,omitempty"` + DismissedBy *User `json:"dismissed_by,omitempty"` + DismissedReason *string `json:"dismissed_reason,omitempty"` + DismissedComment *string `json:"dismissed_comment,omitempty"` + FixedAt *Timestamp `json:"fixed_at,omitempty"` + AutoDismissedAt *Timestamp `json:"auto_dismissed_at,omitempty"` + Assignees []*User `json:"assignees,omitempty"` + DismissalRequest *DependabotAlertDismissalRequest `json:"dismissal_request,omitempty"` // The repository is always empty for events Repository *Repository `json:"repository,omitempty"` } +// DependabotAlertDismissalRequest represents a request to dismiss a Dependabot alert. +type DependabotAlertDismissalRequest struct { + ID *int64 `json:"id,omitempty"` + Status *string `json:"status,omitempty"` + Requester *User `json:"requester,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + URL *string `json:"url,omitempty"` +} + // DependabotAlertState represents the state of a Dependabot alert to update. type DependabotAlertState struct { // The state of the Dependabot alert. A dismissed_reason must be provided when setting the state to dismissed. diff --git a/github/github-accessors.go b/github/github-accessors.go index 943e983738e..704e555b7ea 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -1726,6 +1726,14 @@ func (a *AgentTaskSessionError) GetMessage() string { return *a.Message } +// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. +func (a *Alert) GetAssignees() []*User { + if a == nil || a.Assignees == nil { + return nil + } + return a.Assignees +} + // GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. func (a *Alert) GetClosedAt() Timestamp { if a == nil || a.ClosedAt == nil { @@ -1750,6 +1758,14 @@ func (a *Alert) GetCreatedAt() Timestamp { return *a.CreatedAt } +// GetDismissalApprovedBy returns the DismissalApprovedBy field. +func (a *Alert) GetDismissalApprovedBy() *User { + if a == nil { + return nil + } + return a.DismissalApprovedBy +} + // GetDismissedAt returns the DismissedAt field if it's non-nil, zero value otherwise. func (a *Alert) GetDismissedAt() Timestamp { if a == nil || a.DismissedAt == nil { @@ -1814,6 +1830,14 @@ func (a *Alert) GetInstancesURL() string { return *a.InstancesURL } +// GetLinkedPullRequests returns the LinkedPullRequests slice if it's non-nil, nil otherwise. +func (a *Alert) GetLinkedPullRequests() []*PullRequest { + if a == nil || a.LinkedPullRequests == nil { + return nil + } + return a.LinkedPullRequests +} + // GetMostRecentInstance returns the MostRecentInstance field. func (a *Alert) GetMostRecentInstance() *MostRecentInstance { if a == nil { @@ -14758,6 +14782,14 @@ func (d *DeleteEvent) GetSender() *User { return d.Sender } +// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. +func (d *DependabotAlert) GetAssignees() []*User { + if d == nil || d.Assignees == nil { + return nil + } + return d.Assignees +} + // GetAutoDismissedAt returns the AutoDismissedAt field if it's non-nil, zero value otherwise. func (d *DependabotAlert) GetAutoDismissedAt() Timestamp { if d == nil || d.AutoDismissedAt == nil { @@ -14782,6 +14814,14 @@ func (d *DependabotAlert) GetDependency() *Dependency { return d.Dependency } +// GetDismissalRequest returns the DismissalRequest field. +func (d *DependabotAlert) GetDismissalRequest() *DependabotAlertDismissalRequest { + if d == nil { + return nil + } + return d.DismissalRequest +} + // GetDismissedAt returns the DismissedAt field if it's non-nil, zero value otherwise. func (d *DependabotAlert) GetDismissedAt() Timestamp { if d == nil || d.DismissedAt == nil { @@ -14886,6 +14926,46 @@ func (d *DependabotAlert) GetURL() string { return *d.URL } +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (d *DependabotAlertDismissalRequest) GetCreatedAt() Timestamp { + if d == nil || d.CreatedAt == nil { + return Timestamp{} + } + return *d.CreatedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (d *DependabotAlertDismissalRequest) GetID() int64 { + if d == nil || d.ID == nil { + return 0 + } + return *d.ID +} + +// GetRequester returns the Requester field. +func (d *DependabotAlertDismissalRequest) GetRequester() *User { + if d == nil { + return nil + } + return d.Requester +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (d *DependabotAlertDismissalRequest) GetStatus() string { + if d == nil || d.Status == nil { + return "" + } + return *d.Status +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (d *DependabotAlertDismissalRequest) GetURL() string { + if d == nil || d.URL == nil { + return "" + } + return *d.URL +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (d *DependabotAlertEvent) GetAction() string { if d == nil || d.Action == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 2b9fc86879d..63ab4bf8ce9 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -2105,6 +2105,17 @@ func TestAgentTaskSessionError_GetMessage(tt *testing.T) { a.GetMessage() } +func TestAlert_GetAssignees(tt *testing.T) { + tt.Parallel() + zeroValue := []*User{} + a := &Alert{Assignees: zeroValue} + a.GetAssignees() + a = &Alert{} + a.GetAssignees() + a = nil + a.GetAssignees() +} + func TestAlert_GetClosedAt(tt *testing.T) { tt.Parallel() var zeroValue Timestamp @@ -2135,6 +2146,14 @@ func TestAlert_GetCreatedAt(tt *testing.T) { a.GetCreatedAt() } +func TestAlert_GetDismissalApprovedBy(tt *testing.T) { + tt.Parallel() + a := &Alert{} + a.GetDismissalApprovedBy() + a = nil + a.GetDismissalApprovedBy() +} + func TestAlert_GetDismissedAt(tt *testing.T) { tt.Parallel() var zeroValue Timestamp @@ -2220,6 +2239,17 @@ func TestAlert_GetInstancesURL(tt *testing.T) { a.GetInstancesURL() } +func TestAlert_GetLinkedPullRequests(tt *testing.T) { + tt.Parallel() + zeroValue := []*PullRequest{} + a := &Alert{LinkedPullRequests: zeroValue} + a.GetLinkedPullRequests() + a = &Alert{} + a.GetLinkedPullRequests() + a = nil + a.GetLinkedPullRequests() +} + func TestAlert_GetMostRecentInstance(tt *testing.T) { tt.Parallel() a := &Alert{} @@ -18569,6 +18599,17 @@ func TestDeleteEvent_GetSender(tt *testing.T) { d.GetSender() } +func TestDependabotAlert_GetAssignees(tt *testing.T) { + tt.Parallel() + zeroValue := []*User{} + d := &DependabotAlert{Assignees: zeroValue} + d.GetAssignees() + d = &DependabotAlert{} + d.GetAssignees() + d = nil + d.GetAssignees() +} + func TestDependabotAlert_GetAutoDismissedAt(tt *testing.T) { tt.Parallel() var zeroValue Timestamp @@ -18599,6 +18640,14 @@ func TestDependabotAlert_GetDependency(tt *testing.T) { d.GetDependency() } +func TestDependabotAlert_GetDismissalRequest(tt *testing.T) { + tt.Parallel() + d := &DependabotAlert{} + d.GetDismissalRequest() + d = nil + d.GetDismissalRequest() +} + func TestDependabotAlert_GetDismissedAt(tt *testing.T) { tt.Parallel() var zeroValue Timestamp @@ -18730,6 +18779,58 @@ func TestDependabotAlert_GetURL(tt *testing.T) { d.GetURL() } +func TestDependabotAlertDismissalRequest_GetCreatedAt(tt *testing.T) { + tt.Parallel() + var zeroValue Timestamp + d := &DependabotAlertDismissalRequest{CreatedAt: &zeroValue} + d.GetCreatedAt() + d = &DependabotAlertDismissalRequest{} + d.GetCreatedAt() + d = nil + d.GetCreatedAt() +} + +func TestDependabotAlertDismissalRequest_GetID(tt *testing.T) { + tt.Parallel() + var zeroValue int64 + d := &DependabotAlertDismissalRequest{ID: &zeroValue} + d.GetID() + d = &DependabotAlertDismissalRequest{} + d.GetID() + d = nil + d.GetID() +} + +func TestDependabotAlertDismissalRequest_GetRequester(tt *testing.T) { + tt.Parallel() + d := &DependabotAlertDismissalRequest{} + d.GetRequester() + d = nil + d.GetRequester() +} + +func TestDependabotAlertDismissalRequest_GetStatus(tt *testing.T) { + tt.Parallel() + var zeroValue string + d := &DependabotAlertDismissalRequest{Status: &zeroValue} + d.GetStatus() + d = &DependabotAlertDismissalRequest{} + d.GetStatus() + d = nil + d.GetStatus() +} + +func TestDependabotAlertDismissalRequest_GetURL(tt *testing.T) { + tt.Parallel() + var zeroValue string + d := &DependabotAlertDismissalRequest{URL: &zeroValue} + d.GetURL() + d = &DependabotAlertDismissalRequest{} + d.GetURL() + d = nil + d.GetURL() +} + func TestDependabotAlertEvent_GetAction(tt *testing.T) { tt.Parallel() var zeroValue string From bf1de8bc0b2fd53fa60ec84ba96987ec854c84c1 Mon Sep 17 00:00:00 2001 From: JamBalaya56562 Date: Tue, 13 Oct 2026 20:52:55 +0900 Subject: [PATCH 2/3] feat!: Support assigning `CodeScanningAlertState` and `DependabotAlertState` without a state --- github/code_scanning.go | 10 +++- github/code_scanning_test.go | 23 ++++++++- github/dependabot_alerts.go | 15 +++++- github/dependabot_alerts_test.go | 26 +++++++++- github/github-accessors.go | 68 +++++++++++++++++++++++--- github/github-accessors_test.go | 84 +++++++++++++++++++++++++++++++- 6 files changed, 213 insertions(+), 13 deletions(-) diff --git a/github/code_scanning.go b/github/code_scanning.go index 8d7e6b56f22..e51992383c6 100644 --- a/github/code_scanning.go +++ b/github/code_scanning.go @@ -225,16 +225,22 @@ type SarifAnalysis struct { // // GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type CodeScanningAlertState struct { - // State sets the state of the code scanning alert and is a required field. + // State sets the state of the code scanning alert. + // Either State or Assignees must be provided. // You must also provide DismissedReason when you set the state to "dismissed". // State can be one of: "open", "dismissed". - State string `json:"state"` + State *string `json:"state,omitempty"` // DismissedReason represents the reason for dismissing or closing the alert. // It is required when the state is "dismissed". // It can be one of: "false positive", "won't fix", "used in tests". DismissedReason *string `json:"dismissed_reason,omitempty"` // DismissedComment is associated with the dismissal of the alert. DismissedComment *string `json:"dismissed_comment,omitempty"` + // CreateRequest, if true, attempts to create an alert dismissal request. + CreateRequest *bool `json:"create_request,omitempty"` + // Assignees replaces the users assigned to the alert. + // Either State or Assignees must be provided. An empty slice removes all assignees. + Assignees []string `json:"assignees,omitzero"` } // SarifID identifies a sarif analysis upload. diff --git a/github/code_scanning_test.go b/github/code_scanning_test.go index c4e4a70ccf7..386106dcc08 100644 --- a/github/code_scanning_test.go +++ b/github/code_scanning_test.go @@ -709,7 +709,7 @@ func TestCodeScanningService_UpdateAlert(t *testing.T) { dismissedComment := new("This alert is not actually correct as sanitizer is used") dismissedReason := new("false positive") state := new("dismissed") - stateInfo := &CodeScanningAlertState{State: *state, DismissedReason: dismissedReason, DismissedComment: dismissedComment} + stateInfo := &CodeScanningAlertState{State: state, DismissedReason: dismissedReason, DismissedComment: dismissedComment} alert, _, err := client.CodeScanning.UpdateAlert(ctx, "o", "r", 88, stateInfo) if err != nil { t.Errorf("CodeScanning.UpdateAlert returned error: %v", err) @@ -772,6 +772,27 @@ func TestCodeScanningService_UpdateAlert(t *testing.T) { }) } +func TestCodeScanningAlertState_Marshal(t *testing.T) { + t.Parallel() + + dismissInput := CodeScanningAlertState{ + State: new("dismissed"), + DismissedReason: new("false positive"), + CreateRequest: new(true), + } + testJSONMarshal(t, dismissInput, `{"state":"dismissed","dismissed_reason":"false positive","create_request":true}`) + + assignInput := CodeScanningAlertState{ + Assignees: []string{"octocat"}, + } + testJSONMarshal(t, assignInput, `{"assignees":["octocat"]}`) + + unassignInput := CodeScanningAlertState{ + Assignees: []string{}, + } + testJSONMarshal(t, unassignInput, `{"assignees":[]}`) +} + func TestCodeScanningService_ListAlertInstances(t *testing.T) { t.Parallel() client, mux, _ := setup(t) diff --git a/github/dependabot_alerts.go b/github/dependabot_alerts.go index 4713b3424bb..5f3eca1dbf1 100644 --- a/github/dependabot_alerts.go +++ b/github/dependabot_alerts.go @@ -100,12 +100,25 @@ type DependabotAlertDismissalRequest struct { // DependabotAlertState represents the state of a Dependabot alert to update. type DependabotAlertState struct { // The state of the Dependabot alert. A dismissed_reason must be provided when setting the state to dismissed. - State string `json:"state"` + // Either State or Assignees must be provided. + State *string `json:"state,omitempty"` // Required when state is dismissed. A reason for dismissing the alert. // Can be one of: fix_started, inaccurate, no_bandwidth, not_used, tolerable_risk DismissedReason *string `json:"dismissed_reason,omitempty"` // An optional comment associated with dismissing the alert. DismissedComment *string `json:"dismissed_comment,omitempty"` + // Usernames to assign to the alert, replacing the current assignees. + // Either State or Assignees must be provided. An empty slice removes all assignees. + Assignees []string `json:"assignees,omitzero"` + // Parameters for AI agent assignment. Only used when an agent bot login is included in Assignees. + AgentAssignment *DependabotAlertAgentAssignment `json:"agent_assignment,omitempty"` +} + +// DependabotAlertAgentAssignment represents the parameters for assigning an AI agent to a Dependabot alert. +type DependabotAlertAgentAssignment struct { + CustomInstructions *string `json:"custom_instructions,omitempty"` + CustomAgent *string `json:"custom_agent,omitempty"` + Model *string `json:"model,omitempty"` } // ListAlertsOptions specifies the optional parameters to the DependabotService.ListRepoAlerts diff --git a/github/dependabot_alerts_test.go b/github/dependabot_alerts_test.go index 7406e9217f6..6b6276cf766 100644 --- a/github/dependabot_alerts_test.go +++ b/github/dependabot_alerts_test.go @@ -139,7 +139,7 @@ func TestDependabotService_UpdateAlert(t *testing.T) { dismissedReason := new("no_bandwidth") dismissedComment := new("no time to fix this") - alertState := &DependabotAlertState{State: *state, DismissedReason: dismissedReason, DismissedComment: dismissedComment} + alertState := &DependabotAlertState{State: state, DismissedReason: dismissedReason, DismissedComment: dismissedComment} mux.HandleFunc("/repos/o/r/dependabot/alerts/42", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -176,3 +176,27 @@ func TestDependabotService_UpdateAlert(t *testing.T) { return resp, err }) } + +func TestDependabotAlertState_Marshal(t *testing.T) { + t.Parallel() + + dismissInput := DependabotAlertState{ + State: new("dismissed"), + DismissedReason: new("no_bandwidth"), + } + testJSONMarshal(t, dismissInput, `{"state":"dismissed","dismissed_reason":"no_bandwidth"}`) + + assignInput := DependabotAlertState{ + Assignees: []string{"copilot-swe-agent[bot]"}, + AgentAssignment: &DependabotAlertAgentAssignment{ + CustomInstructions: new("Upgrade the dependency"), + Model: new("m"), + }, + } + testJSONMarshal(t, assignInput, `{"assignees":["copilot-swe-agent[bot]"],"agent_assignment":{"custom_instructions":"Upgrade the dependency","model":"m"}}`) + + unassignInput := DependabotAlertState{ + Assignees: []string{}, + } + testJSONMarshal(t, unassignInput, `{"assignees":[]}`) +} diff --git a/github/github-accessors.go b/github/github-accessors.go index 704e555b7ea..87ae53ded94 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -6054,6 +6054,22 @@ func (c *CodeScanningAlertEvent) GetSender() *User { return c.Sender } +// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. +func (c *CodeScanningAlertState) GetAssignees() []string { + if c == nil || c.Assignees == nil { + return nil + } + return c.Assignees +} + +// GetCreateRequest returns the CreateRequest field if it's non-nil, zero value otherwise. +func (c *CodeScanningAlertState) GetCreateRequest() bool { + if c == nil || c.CreateRequest == nil { + return false + } + return *c.CreateRequest +} + // GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. func (c *CodeScanningAlertState) GetDismissedComment() string { if c == nil || c.DismissedComment == nil { @@ -6070,12 +6086,12 @@ func (c *CodeScanningAlertState) GetDismissedReason() string { return *c.DismissedReason } -// GetState returns the State field. +// GetState returns the State field if it's non-nil, zero value otherwise. func (c *CodeScanningAlertState) GetState() string { - if c == nil { + if c == nil || c.State == nil { return "" } - return c.State + return *c.State } // GetParameters returns the Parameters field. @@ -14926,6 +14942,30 @@ func (d *DependabotAlert) GetURL() string { return *d.URL } +// GetCustomAgent returns the CustomAgent field if it's non-nil, zero value otherwise. +func (d *DependabotAlertAgentAssignment) GetCustomAgent() string { + if d == nil || d.CustomAgent == nil { + return "" + } + return *d.CustomAgent +} + +// GetCustomInstructions returns the CustomInstructions field if it's non-nil, zero value otherwise. +func (d *DependabotAlertAgentAssignment) GetCustomInstructions() string { + if d == nil || d.CustomInstructions == nil { + return "" + } + return *d.CustomInstructions +} + +// GetModel returns the Model field if it's non-nil, zero value otherwise. +func (d *DependabotAlertAgentAssignment) GetModel() string { + if d == nil || d.Model == nil { + return "" + } + return *d.Model +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (d *DependabotAlertDismissalRequest) GetCreatedAt() Timestamp { if d == nil || d.CreatedAt == nil { @@ -15022,6 +15062,22 @@ func (d *DependabotAlertEvent) GetSender() *User { return d.Sender } +// GetAgentAssignment returns the AgentAssignment field. +func (d *DependabotAlertState) GetAgentAssignment() *DependabotAlertAgentAssignment { + if d == nil { + return nil + } + return d.AgentAssignment +} + +// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. +func (d *DependabotAlertState) GetAssignees() []string { + if d == nil || d.Assignees == nil { + return nil + } + return d.Assignees +} + // GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. func (d *DependabotAlertState) GetDismissedComment() string { if d == nil || d.DismissedComment == nil { @@ -15038,12 +15094,12 @@ func (d *DependabotAlertState) GetDismissedReason() string { return *d.DismissedReason } -// GetState returns the State field. +// GetState returns the State field if it's non-nil, zero value otherwise. func (d *DependabotAlertState) GetState() string { - if d == nil { + if d == nil || d.State == nil { return "" } - return d.State + return *d.State } // GetClassification returns the Classification field if it's non-nil, zero value otherwise. diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 63ab4bf8ce9..72d974cde87 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -7627,6 +7627,28 @@ func TestCodeScanningAlertEvent_GetSender(tt *testing.T) { c.GetSender() } +func TestCodeScanningAlertState_GetAssignees(tt *testing.T) { + tt.Parallel() + zeroValue := []string{} + c := &CodeScanningAlertState{Assignees: zeroValue} + c.GetAssignees() + c = &CodeScanningAlertState{} + c.GetAssignees() + c = nil + c.GetAssignees() +} + +func TestCodeScanningAlertState_GetCreateRequest(tt *testing.T) { + tt.Parallel() + var zeroValue bool + c := &CodeScanningAlertState{CreateRequest: &zeroValue} + c.GetCreateRequest() + c = &CodeScanningAlertState{} + c.GetCreateRequest() + c = nil + c.GetCreateRequest() +} + func TestCodeScanningAlertState_GetDismissedComment(tt *testing.T) { tt.Parallel() var zeroValue string @@ -7651,7 +7673,10 @@ func TestCodeScanningAlertState_GetDismissedReason(tt *testing.T) { func TestCodeScanningAlertState_GetState(tt *testing.T) { tt.Parallel() - c := &CodeScanningAlertState{} + var zeroValue string + c := &CodeScanningAlertState{State: &zeroValue} + c.GetState() + c = &CodeScanningAlertState{} c.GetState() c = nil c.GetState() @@ -18779,6 +18804,39 @@ func TestDependabotAlert_GetURL(tt *testing.T) { d.GetURL() } +func TestDependabotAlertAgentAssignment_GetCustomAgent(tt *testing.T) { + tt.Parallel() + var zeroValue string + d := &DependabotAlertAgentAssignment{CustomAgent: &zeroValue} + d.GetCustomAgent() + d = &DependabotAlertAgentAssignment{} + d.GetCustomAgent() + d = nil + d.GetCustomAgent() +} + +func TestDependabotAlertAgentAssignment_GetCustomInstructions(tt *testing.T) { + tt.Parallel() + var zeroValue string + d := &DependabotAlertAgentAssignment{CustomInstructions: &zeroValue} + d.GetCustomInstructions() + d = &DependabotAlertAgentAssignment{} + d.GetCustomInstructions() + d = nil + d.GetCustomInstructions() +} + +func TestDependabotAlertAgentAssignment_GetModel(tt *testing.T) { + tt.Parallel() + var zeroValue string + d := &DependabotAlertAgentAssignment{Model: &zeroValue} + d.GetModel() + d = &DependabotAlertAgentAssignment{} + d.GetModel() + d = nil + d.GetModel() +} + func TestDependabotAlertDismissalRequest_GetCreatedAt(tt *testing.T) { tt.Parallel() var zeroValue Timestamp @@ -18890,6 +18948,25 @@ func TestDependabotAlertEvent_GetSender(tt *testing.T) { d.GetSender() } +func TestDependabotAlertState_GetAgentAssignment(tt *testing.T) { + tt.Parallel() + d := &DependabotAlertState{} + d.GetAgentAssignment() + d = nil + d.GetAgentAssignment() +} + +func TestDependabotAlertState_GetAssignees(tt *testing.T) { + tt.Parallel() + zeroValue := []string{} + d := &DependabotAlertState{Assignees: zeroValue} + d.GetAssignees() + d = &DependabotAlertState{} + d.GetAssignees() + d = nil + d.GetAssignees() +} + func TestDependabotAlertState_GetDismissedComment(tt *testing.T) { tt.Parallel() var zeroValue string @@ -18914,7 +18991,10 @@ func TestDependabotAlertState_GetDismissedReason(tt *testing.T) { func TestDependabotAlertState_GetState(tt *testing.T) { tt.Parallel() - d := &DependabotAlertState{} + var zeroValue string + d := &DependabotAlertState{State: &zeroValue} + d.GetState() + d = &DependabotAlertState{} d.GetState() d = nil d.GetState() From ce99aad6a7fb3831a0b548062171789b20373a80 Mon Sep 17 00:00:00 2001 From: JamBalaya56562 Date: Tue, 13 Oct 2026 20:54:30 +0900 Subject: [PATCH 3/3] refactor!: Rename `CodeScanningAlertState` and `DependabotAlertState` to `...Request` and pass them by value --- .golangci.yml | 2 - github/code_scanning.go | 6 +- github/code_scanning_test.go | 16 +-- github/dependabot_alerts.go | 6 +- github/dependabot_alerts_test.go | 16 +-- github/github-accessors.go | 160 +++++++++++------------ github/github-accessors_test.go | 214 +++++++++++++++---------------- 7 files changed, 209 insertions(+), 211 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 02bb8bf9c44..d6c2f39049f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -203,7 +203,6 @@ linters: # TODO: fix and remove these exceptions. body-allowed-pointer-types: - AuthorizationRequest - - CodeScanningAlertState - ConfigApplyOptions - ConfigSettings - CreateOrUpdateIssueTypesOptions @@ -211,7 +210,6 @@ linters: - CreateWorkflowDispatchEventRequest - CustomDeploymentProtectionRuleRequest - CustomProperty - - DependabotAlertState - EncryptedSecret - EnterpriseSecurityAnalysisSettings - Hook diff --git a/github/code_scanning.go b/github/code_scanning.go index e51992383c6..f053902bc7e 100644 --- a/github/code_scanning.go +++ b/github/code_scanning.go @@ -221,10 +221,10 @@ type SarifAnalysis struct { Validate *bool `json:"validate,omitempty"` } -// CodeScanningAlertState specifies the state of a code scanning alert. +// UpdateCodeScanningAlertRequest represents a request to update a code scanning alert. // // GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 -type CodeScanningAlertState struct { +type UpdateCodeScanningAlertRequest struct { // State sets the state of the code scanning alert. // Either State or Assignees must be provided. // You must also provide DismissedReason when you set the state to "dismissed". @@ -347,7 +347,7 @@ func (s *CodeScanningService) GetAlert(ctx context.Context, owner, repo string, // GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#update-a-code-scanning-alert // //meta:operation PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} -func (s *CodeScanningService) UpdateAlert(ctx context.Context, owner, repo string, id int64, body *CodeScanningAlertState) (*Alert, *Response, error) { +func (s *CodeScanningService) UpdateAlert(ctx context.Context, owner, repo string, id int64, body UpdateCodeScanningAlertRequest) (*Alert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v", owner, repo, id) req, err := s.client.NewRequest(ctx, "PATCH", u, body) diff --git a/github/code_scanning_test.go b/github/code_scanning_test.go index 386106dcc08..ede29f31560 100644 --- a/github/code_scanning_test.go +++ b/github/code_scanning_test.go @@ -709,8 +709,8 @@ func TestCodeScanningService_UpdateAlert(t *testing.T) { dismissedComment := new("This alert is not actually correct as sanitizer is used") dismissedReason := new("false positive") state := new("dismissed") - stateInfo := &CodeScanningAlertState{State: state, DismissedReason: dismissedReason, DismissedComment: dismissedComment} - alert, _, err := client.CodeScanning.UpdateAlert(ctx, "o", "r", 88, stateInfo) + body := UpdateCodeScanningAlertRequest{State: state, DismissedReason: dismissedReason, DismissedComment: dismissedComment} + alert, _, err := client.CodeScanning.UpdateAlert(ctx, "o", "r", 88, body) if err != nil { t.Errorf("CodeScanning.UpdateAlert returned error: %v", err) } @@ -759,12 +759,12 @@ func TestCodeScanningService_UpdateAlert(t *testing.T) { const methodName = "UpdateAlert" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.CodeScanning.UpdateAlert(ctx, "\n", "\n", -88, stateInfo) + _, _, err = client.CodeScanning.UpdateAlert(ctx, "\n", "\n", -88, body) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.CodeScanning.UpdateAlert(ctx, "o", "r", 88, stateInfo) + got, resp, err := client.CodeScanning.UpdateAlert(ctx, "o", "r", 88, body) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -772,22 +772,22 @@ func TestCodeScanningService_UpdateAlert(t *testing.T) { }) } -func TestCodeScanningAlertState_Marshal(t *testing.T) { +func TestUpdateCodeScanningAlertRequest_Marshal(t *testing.T) { t.Parallel() - dismissInput := CodeScanningAlertState{ + dismissInput := UpdateCodeScanningAlertRequest{ State: new("dismissed"), DismissedReason: new("false positive"), CreateRequest: new(true), } testJSONMarshal(t, dismissInput, `{"state":"dismissed","dismissed_reason":"false positive","create_request":true}`) - assignInput := CodeScanningAlertState{ + assignInput := UpdateCodeScanningAlertRequest{ Assignees: []string{"octocat"}, } testJSONMarshal(t, assignInput, `{"assignees":["octocat"]}`) - unassignInput := CodeScanningAlertState{ + unassignInput := UpdateCodeScanningAlertRequest{ Assignees: []string{}, } testJSONMarshal(t, unassignInput, `{"assignees":[]}`) diff --git a/github/dependabot_alerts.go b/github/dependabot_alerts.go index 5f3eca1dbf1..20b238efd8a 100644 --- a/github/dependabot_alerts.go +++ b/github/dependabot_alerts.go @@ -97,8 +97,8 @@ type DependabotAlertDismissalRequest struct { URL *string `json:"url,omitempty"` } -// DependabotAlertState represents the state of a Dependabot alert to update. -type DependabotAlertState struct { +// UpdateDependabotAlertRequest represents a request to update a Dependabot alert. +type UpdateDependabotAlertRequest struct { // The state of the Dependabot alert. A dismissed_reason must be provided when setting the state to dismissed. // Either State or Assignees must be provided. State *string `json:"state,omitempty"` @@ -202,7 +202,7 @@ func (s *DependabotService) GetRepoAlert(ctx context.Context, owner, repo string // GitHub API docs: https://docs.github.com/rest/dependabot/alerts?apiVersion=2022-11-28#update-a-dependabot-alert // //meta:operation PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number} -func (s *DependabotService) UpdateAlert(ctx context.Context, owner, repo string, number int, body *DependabotAlertState) (*DependabotAlert, *Response, error) { +func (s *DependabotService) UpdateAlert(ctx context.Context, owner, repo string, number int, body UpdateDependabotAlertRequest) (*DependabotAlert, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/alerts/%v", owner, repo, number) req, err := s.client.NewRequest(ctx, "PATCH", url, body) if err != nil { diff --git a/github/dependabot_alerts_test.go b/github/dependabot_alerts_test.go index 6b6276cf766..1a52e03f5f2 100644 --- a/github/dependabot_alerts_test.go +++ b/github/dependabot_alerts_test.go @@ -139,7 +139,7 @@ func TestDependabotService_UpdateAlert(t *testing.T) { dismissedReason := new("no_bandwidth") dismissedComment := new("no time to fix this") - alertState := &DependabotAlertState{State: state, DismissedReason: dismissedReason, DismissedComment: dismissedComment} + body := UpdateDependabotAlertRequest{State: state, DismissedReason: dismissedReason, DismissedComment: dismissedComment} mux.HandleFunc("/repos/o/r/dependabot/alerts/42", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") @@ -147,7 +147,7 @@ func TestDependabotService_UpdateAlert(t *testing.T) { }) ctx := t.Context() - alert, _, err := client.Dependabot.UpdateAlert(ctx, "o", "r", 42, alertState) + alert, _, err := client.Dependabot.UpdateAlert(ctx, "o", "r", 42, body) if err != nil { t.Errorf("Dependabot.UpdateAlert returned error: %v", err) } @@ -164,12 +164,12 @@ func TestDependabotService_UpdateAlert(t *testing.T) { const methodName = "UpdateAlert" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Dependabot.UpdateAlert(ctx, "\n", "\n", 0, alertState) + _, _, err = client.Dependabot.UpdateAlert(ctx, "\n", "\n", 0, body) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Dependabot.UpdateAlert(ctx, "o", "r", 42, alertState) + got, resp, err := client.Dependabot.UpdateAlert(ctx, "o", "r", 42, body) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -177,16 +177,16 @@ func TestDependabotService_UpdateAlert(t *testing.T) { }) } -func TestDependabotAlertState_Marshal(t *testing.T) { +func TestUpdateDependabotAlertRequest_Marshal(t *testing.T) { t.Parallel() - dismissInput := DependabotAlertState{ + dismissInput := UpdateDependabotAlertRequest{ State: new("dismissed"), DismissedReason: new("no_bandwidth"), } testJSONMarshal(t, dismissInput, `{"state":"dismissed","dismissed_reason":"no_bandwidth"}`) - assignInput := DependabotAlertState{ + assignInput := UpdateDependabotAlertRequest{ Assignees: []string{"copilot-swe-agent[bot]"}, AgentAssignment: &DependabotAlertAgentAssignment{ CustomInstructions: new("Upgrade the dependency"), @@ -195,7 +195,7 @@ func TestDependabotAlertState_Marshal(t *testing.T) { } testJSONMarshal(t, assignInput, `{"assignees":["copilot-swe-agent[bot]"],"agent_assignment":{"custom_instructions":"Upgrade the dependency","model":"m"}}`) - unassignInput := DependabotAlertState{ + unassignInput := UpdateDependabotAlertRequest{ Assignees: []string{}, } testJSONMarshal(t, unassignInput, `{"assignees":[]}`) diff --git a/github/github-accessors.go b/github/github-accessors.go index 87ae53ded94..058bd0abba3 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -6054,46 +6054,6 @@ func (c *CodeScanningAlertEvent) GetSender() *User { return c.Sender } -// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. -func (c *CodeScanningAlertState) GetAssignees() []string { - if c == nil || c.Assignees == nil { - return nil - } - return c.Assignees -} - -// GetCreateRequest returns the CreateRequest field if it's non-nil, zero value otherwise. -func (c *CodeScanningAlertState) GetCreateRequest() bool { - if c == nil || c.CreateRequest == nil { - return false - } - return *c.CreateRequest -} - -// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. -func (c *CodeScanningAlertState) GetDismissedComment() string { - if c == nil || c.DismissedComment == nil { - return "" - } - return *c.DismissedComment -} - -// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. -func (c *CodeScanningAlertState) GetDismissedReason() string { - if c == nil || c.DismissedReason == nil { - return "" - } - return *c.DismissedReason -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (c *CodeScanningAlertState) GetState() string { - if c == nil || c.State == nil { - return "" - } - return *c.State -} - // GetParameters returns the Parameters field. func (c *CodeScanningBranchRule) GetParameters() CodeScanningRuleParameters { if c == nil { @@ -15062,46 +15022,6 @@ func (d *DependabotAlertEvent) GetSender() *User { return d.Sender } -// GetAgentAssignment returns the AgentAssignment field. -func (d *DependabotAlertState) GetAgentAssignment() *DependabotAlertAgentAssignment { - if d == nil { - return nil - } - return d.AgentAssignment -} - -// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. -func (d *DependabotAlertState) GetAssignees() []string { - if d == nil || d.Assignees == nil { - return nil - } - return d.Assignees -} - -// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. -func (d *DependabotAlertState) GetDismissedComment() string { - if d == nil || d.DismissedComment == nil { - return "" - } - return *d.DismissedComment -} - -// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. -func (d *DependabotAlertState) GetDismissedReason() string { - if d == nil || d.DismissedReason == nil { - return "" - } - return *d.DismissedReason -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (d *DependabotAlertState) GetState() string { - if d == nil || d.State == nil { - return "" - } - return *d.State -} - // GetClassification returns the Classification field if it's non-nil, zero value otherwise. func (d *DependabotSecurityAdvisory) GetClassification() string { if d == nil || d.Classification == nil { @@ -45998,6 +45918,46 @@ func (u *UpdateCheckRunOptions) GetStatus() string { return *u.Status } +// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. +func (u *UpdateCodeScanningAlertRequest) GetAssignees() []string { + if u == nil || u.Assignees == nil { + return nil + } + return u.Assignees +} + +// GetCreateRequest returns the CreateRequest field if it's non-nil, zero value otherwise. +func (u *UpdateCodeScanningAlertRequest) GetCreateRequest() bool { + if u == nil || u.CreateRequest == nil { + return false + } + return *u.CreateRequest +} + +// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. +func (u *UpdateCodeScanningAlertRequest) GetDismissedComment() string { + if u == nil || u.DismissedComment == nil { + return "" + } + return *u.DismissedComment +} + +// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. +func (u *UpdateCodeScanningAlertRequest) GetDismissedReason() string { + if u == nil || u.DismissedReason == nil { + return "" + } + return *u.DismissedReason +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (u *UpdateCodeScanningAlertRequest) GetState() string { + if u == nil || u.State == nil { + return "" + } + return *u.State +} + // GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. func (u *UpdateCodespaceRequest) GetDisplayName() string { if u == nil || u.DisplayName == nil { @@ -46174,6 +46134,46 @@ func (u *UpdateDefaultSetupConfigurationResponse) GetRunURL() string { return *u.RunURL } +// GetAgentAssignment returns the AgentAssignment field. +func (u *UpdateDependabotAlertRequest) GetAgentAssignment() *DependabotAlertAgentAssignment { + if u == nil { + return nil + } + return u.AgentAssignment +} + +// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. +func (u *UpdateDependabotAlertRequest) GetAssignees() []string { + if u == nil || u.Assignees == nil { + return nil + } + return u.Assignees +} + +// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. +func (u *UpdateDependabotAlertRequest) GetDismissedComment() string { + if u == nil || u.DismissedComment == nil { + return "" + } + return *u.DismissedComment +} + +// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. +func (u *UpdateDependabotAlertRequest) GetDismissedReason() string { + if u == nil || u.DismissedReason == nil { + return "" + } + return *u.DismissedReason +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (u *UpdateDependabotAlertRequest) GetState() string { + if u == nil || u.State == nil { + return "" + } + return *u.State +} + // GetName returns the Name field. func (u *UpdateDeploymentBranchPolicyRequest) GetName() string { if u == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 72d974cde87..8083ec65a15 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -7627,61 +7627,6 @@ func TestCodeScanningAlertEvent_GetSender(tt *testing.T) { c.GetSender() } -func TestCodeScanningAlertState_GetAssignees(tt *testing.T) { - tt.Parallel() - zeroValue := []string{} - c := &CodeScanningAlertState{Assignees: zeroValue} - c.GetAssignees() - c = &CodeScanningAlertState{} - c.GetAssignees() - c = nil - c.GetAssignees() -} - -func TestCodeScanningAlertState_GetCreateRequest(tt *testing.T) { - tt.Parallel() - var zeroValue bool - c := &CodeScanningAlertState{CreateRequest: &zeroValue} - c.GetCreateRequest() - c = &CodeScanningAlertState{} - c.GetCreateRequest() - c = nil - c.GetCreateRequest() -} - -func TestCodeScanningAlertState_GetDismissedComment(tt *testing.T) { - tt.Parallel() - var zeroValue string - c := &CodeScanningAlertState{DismissedComment: &zeroValue} - c.GetDismissedComment() - c = &CodeScanningAlertState{} - c.GetDismissedComment() - c = nil - c.GetDismissedComment() -} - -func TestCodeScanningAlertState_GetDismissedReason(tt *testing.T) { - tt.Parallel() - var zeroValue string - c := &CodeScanningAlertState{DismissedReason: &zeroValue} - c.GetDismissedReason() - c = &CodeScanningAlertState{} - c.GetDismissedReason() - c = nil - c.GetDismissedReason() -} - -func TestCodeScanningAlertState_GetState(tt *testing.T) { - tt.Parallel() - var zeroValue string - c := &CodeScanningAlertState{State: &zeroValue} - c.GetState() - c = &CodeScanningAlertState{} - c.GetState() - c = nil - c.GetState() -} - func TestCodeScanningBranchRule_GetParameters(tt *testing.T) { tt.Parallel() c := &CodeScanningBranchRule{} @@ -18948,58 +18893,6 @@ func TestDependabotAlertEvent_GetSender(tt *testing.T) { d.GetSender() } -func TestDependabotAlertState_GetAgentAssignment(tt *testing.T) { - tt.Parallel() - d := &DependabotAlertState{} - d.GetAgentAssignment() - d = nil - d.GetAgentAssignment() -} - -func TestDependabotAlertState_GetAssignees(tt *testing.T) { - tt.Parallel() - zeroValue := []string{} - d := &DependabotAlertState{Assignees: zeroValue} - d.GetAssignees() - d = &DependabotAlertState{} - d.GetAssignees() - d = nil - d.GetAssignees() -} - -func TestDependabotAlertState_GetDismissedComment(tt *testing.T) { - tt.Parallel() - var zeroValue string - d := &DependabotAlertState{DismissedComment: &zeroValue} - d.GetDismissedComment() - d = &DependabotAlertState{} - d.GetDismissedComment() - d = nil - d.GetDismissedComment() -} - -func TestDependabotAlertState_GetDismissedReason(tt *testing.T) { - tt.Parallel() - var zeroValue string - d := &DependabotAlertState{DismissedReason: &zeroValue} - d.GetDismissedReason() - d = &DependabotAlertState{} - d.GetDismissedReason() - d = nil - d.GetDismissedReason() -} - -func TestDependabotAlertState_GetState(tt *testing.T) { - tt.Parallel() - var zeroValue string - d := &DependabotAlertState{State: &zeroValue} - d.GetState() - d = &DependabotAlertState{} - d.GetState() - d = nil - d.GetState() -} - func TestDependabotSecurityAdvisory_GetClassification(tt *testing.T) { tt.Parallel() var zeroValue string @@ -57342,6 +57235,61 @@ func TestUpdateCheckRunOptions_GetStatus(tt *testing.T) { u.GetStatus() } +func TestUpdateCodeScanningAlertRequest_GetAssignees(tt *testing.T) { + tt.Parallel() + zeroValue := []string{} + u := &UpdateCodeScanningAlertRequest{Assignees: zeroValue} + u.GetAssignees() + u = &UpdateCodeScanningAlertRequest{} + u.GetAssignees() + u = nil + u.GetAssignees() +} + +func TestUpdateCodeScanningAlertRequest_GetCreateRequest(tt *testing.T) { + tt.Parallel() + var zeroValue bool + u := &UpdateCodeScanningAlertRequest{CreateRequest: &zeroValue} + u.GetCreateRequest() + u = &UpdateCodeScanningAlertRequest{} + u.GetCreateRequest() + u = nil + u.GetCreateRequest() +} + +func TestUpdateCodeScanningAlertRequest_GetDismissedComment(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateCodeScanningAlertRequest{DismissedComment: &zeroValue} + u.GetDismissedComment() + u = &UpdateCodeScanningAlertRequest{} + u.GetDismissedComment() + u = nil + u.GetDismissedComment() +} + +func TestUpdateCodeScanningAlertRequest_GetDismissedReason(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateCodeScanningAlertRequest{DismissedReason: &zeroValue} + u.GetDismissedReason() + u = &UpdateCodeScanningAlertRequest{} + u.GetDismissedReason() + u = nil + u.GetDismissedReason() +} + +func TestUpdateCodeScanningAlertRequest_GetState(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateCodeScanningAlertRequest{State: &zeroValue} + u.GetState() + u = &UpdateCodeScanningAlertRequest{} + u.GetState() + u = nil + u.GetState() +} + func TestUpdateCodespaceRequest_GetDisplayName(tt *testing.T) { tt.Parallel() var zeroValue string @@ -57572,6 +57520,58 @@ func TestUpdateDefaultSetupConfigurationResponse_GetRunURL(tt *testing.T) { u.GetRunURL() } +func TestUpdateDependabotAlertRequest_GetAgentAssignment(tt *testing.T) { + tt.Parallel() + u := &UpdateDependabotAlertRequest{} + u.GetAgentAssignment() + u = nil + u.GetAgentAssignment() +} + +func TestUpdateDependabotAlertRequest_GetAssignees(tt *testing.T) { + tt.Parallel() + zeroValue := []string{} + u := &UpdateDependabotAlertRequest{Assignees: zeroValue} + u.GetAssignees() + u = &UpdateDependabotAlertRequest{} + u.GetAssignees() + u = nil + u.GetAssignees() +} + +func TestUpdateDependabotAlertRequest_GetDismissedComment(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateDependabotAlertRequest{DismissedComment: &zeroValue} + u.GetDismissedComment() + u = &UpdateDependabotAlertRequest{} + u.GetDismissedComment() + u = nil + u.GetDismissedComment() +} + +func TestUpdateDependabotAlertRequest_GetDismissedReason(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateDependabotAlertRequest{DismissedReason: &zeroValue} + u.GetDismissedReason() + u = &UpdateDependabotAlertRequest{} + u.GetDismissedReason() + u = nil + u.GetDismissedReason() +} + +func TestUpdateDependabotAlertRequest_GetState(tt *testing.T) { + tt.Parallel() + var zeroValue string + u := &UpdateDependabotAlertRequest{State: &zeroValue} + u.GetState() + u = &UpdateDependabotAlertRequest{} + u.GetState() + u = nil + u.GetState() +} + func TestUpdateDeploymentBranchPolicyRequest_GetName(tt *testing.T) { tt.Parallel() u := &UpdateDeploymentBranchPolicyRequest{}