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 36f42357733..f053902bc7e 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. @@ -218,20 +221,26 @@ 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 { - // State sets the state of the code scanning alert and is a required field. +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". // 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. @@ -338,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 c4e4a70ccf7..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,6 +772,27 @@ func TestCodeScanningService_UpdateAlert(t *testing.T) { }) } +func TestUpdateCodeScanningAlertRequest_Marshal(t *testing.T) { + t.Parallel() + + 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 := UpdateCodeScanningAlertRequest{ + Assignees: []string{"octocat"}, + } + testJSONMarshal(t, assignInput, `{"assignees":["octocat"]}`) + + unassignInput := UpdateCodeScanningAlertRequest{ + 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 6cc37b2c367..20b238efd8a 100644 --- a/github/dependabot_alerts.go +++ b/github/dependabot_alerts.go @@ -67,34 +67,58 @@ 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"` } -// DependabotAlertState represents the state of a Dependabot alert to update. -type DependabotAlertState struct { +// 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"` +} + +// 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. - 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 @@ -178,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 7406e9217f6..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,15 +164,39 @@ 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) } return resp, err }) } + +func TestUpdateDependabotAlertRequest_Marshal(t *testing.T) { + t.Parallel() + + dismissInput := UpdateDependabotAlertRequest{ + State: new("dismissed"), + DismissedReason: new("no_bandwidth"), + } + testJSONMarshal(t, dismissInput, `{"state":"dismissed","dismissed_reason":"no_bandwidth"}`) + + assignInput := UpdateDependabotAlertRequest{ + 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 := UpdateDependabotAlertRequest{ + Assignees: []string{}, + } + testJSONMarshal(t, unassignInput, `{"assignees":[]}`) +} diff --git a/github/github-accessors.go b/github/github-accessors.go index 943e983738e..058bd0abba3 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 { @@ -6030,30 +6054,6 @@ func (c *CodeScanningAlertEvent) GetSender() *User { return c.Sender } -// 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. -func (c *CodeScanningAlertState) GetState() string { - if c == nil { - return "" - } - return c.State -} - // GetParameters returns the Parameters field. func (c *CodeScanningBranchRule) GetParameters() CodeScanningRuleParameters { if c == nil { @@ -14758,6 +14758,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 +14790,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 +14902,70 @@ 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 { + 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 { @@ -14942,30 +15022,6 @@ func (d *DependabotAlertEvent) GetSender() *User { return d.Sender } -// 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. -func (d *DependabotAlertState) GetState() string { - if d == 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 { @@ -45862,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 { @@ -46038,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 2b9fc86879d..8083ec65a15 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{} @@ -7597,36 +7627,6 @@ func TestCodeScanningAlertEvent_GetSender(tt *testing.T) { c.GetSender() } -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() - c := &CodeScanningAlertState{} - c.GetState() - c = nil - c.GetState() -} - func TestCodeScanningBranchRule_GetParameters(tt *testing.T) { tt.Parallel() c := &CodeScanningBranchRule{} @@ -18569,6 +18569,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 +18610,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 +18749,91 @@ 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 + 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 @@ -18789,36 +18893,6 @@ func TestDependabotAlertEvent_GetSender(tt *testing.T) { d.GetSender() } -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() - d := &DependabotAlertState{} - d.GetState() - d = nil - d.GetState() -} - func TestDependabotSecurityAdvisory_GetClassification(tt *testing.T) { tt.Parallel() var zeroValue string @@ -57161,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 @@ -57391,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{}