From f2659fa73309673e89f8642b2cf54d5ba2d76177 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 20:51:19 +0000 Subject: [PATCH 1/3] Initial plan From 8f24615f293d15f49212818117b61669963ddbdd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 21:10:59 +0000 Subject: [PATCH 2/3] Migrate to GitHub REST API version 2026-03-10 Co-authored-by: maxffarrell <72176209+maxffarrell@users.noreply.github.com> --- github/apps.go | 9 +- github/apps_test.go | 2 +- github/attestations.go | 12 +- github/dependabot_alerts.go | 7 + github/event_types.go | 10 +- github/event_types_test.go | 16 +-- github/github-accessors.go | 128 ++++++----------- github/github-accessors_test.go | 158 ++++++--------------- github/github-stringify_test.go | 219 ++++++++++++++--------------- github/github.go | 2 +- github/issues.go | 4 +- github/issues_test.go | 13 +- github/orgs_attestations_test.go | 8 +- github/projects_test.go | 4 - github/pulls.go | 2 - github/pulls_test.go | 42 ------ github/repos.go | 5 - github/repos_attestations_test.go | 8 +- github/search_test.go | 4 - github/security_advisories_test.go | 4 - github/teams.go | 7 - github/teams_test.go | 2 - github/users_attestations_test.go | 8 +- 23 files changed, 234 insertions(+), 440 deletions(-) diff --git a/github/apps.go b/github/apps.go index 2de9ff6ddb6..35507a74c64 100644 --- a/github/apps.go +++ b/github/apps.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" ) @@ -375,7 +376,13 @@ func (s *AppsService) DeleteInstallation(ctx context.Context, id int64) (*Respon return nil, err } - return s.client.Do(ctx, req, nil) + resp, err := s.client.Do(ctx, req, nil) + // GitHub returns 202 Accepted for this endpoint; treat it as success. + var aerr *AcceptedError + if errors.As(err, &aerr) { + return resp, nil + } + return resp, err } // CreateInstallationToken creates a new installation token. diff --git a/github/apps_test.go b/github/apps_test.go index 998806e18cd..db5aec307ab 100644 --- a/github/apps_test.go +++ b/github/apps_test.go @@ -381,7 +381,7 @@ func TestAppsService_DeleteInstallation(t *testing.T) { mux.HandleFunc("/app/installations/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - w.WriteHeader(http.StatusNoContent) + w.WriteHeader(http.StatusAccepted) }) ctx := t.Context() diff --git a/github/attestations.go b/github/attestations.go index 618d5d73f6c..66f38feaf0c 100644 --- a/github/attestations.go +++ b/github/attestations.go @@ -5,20 +5,16 @@ package github -import ( - "encoding/json" -) - // Attestation represents an artifact attestation associated with a repository. -// The provided bundle can be used to verify the provenance of artifacts. +// The provided bundle URL can be used to verify the provenance of artifacts. // // https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds type Attestation struct { - // The attestation's Sigstore Bundle. + // BundleURL is the URL to retrieve the attestation's Sigstore Bundle. // Refer to the sigstore bundle specification for more info: // https://github.com/sigstore/protobuf-specs/blob/main/protos/sigstore_bundle.proto - Bundle json.RawMessage `json:"bundle"` - RepositoryID int64 `json:"repository_id"` + BundleURL *string `json:"bundle_url,omitempty"` + RepositoryID int64 `json:"repository_id"` } // AttestationsResponse represents a collection of artifact attestations. diff --git a/github/dependabot_alerts.go b/github/dependabot_alerts.go index 67e624c9e88..f343ec14b89 100644 --- a/github/dependabot_alerts.go +++ b/github/dependabot_alerts.go @@ -23,6 +23,12 @@ type AdvisoryCVSS struct { VectorString *string `json:"vector_string,omitempty"` } +// AdvisoryCvssSeverities contains CVSS v3 and v4 severity information for a security advisory. +type AdvisoryCvssSeverities struct { + CvssV3 *AdvisoryCVSS `json:"cvss_v3,omitempty"` + CvssV4 *AdvisoryCVSS `json:"cvss_v4,omitempty"` +} + // AdvisoryCWEs represent the advisory pertaining to Common Weakness Enumeration. type AdvisoryCWEs struct { CWEID *string `json:"cwe_id,omitempty"` @@ -47,6 +53,7 @@ type DependabotSecurityAdvisory struct { Vulnerabilities []*AdvisoryVulnerability `json:"vulnerabilities,omitempty"` Severity *string `json:"severity,omitempty"` CVSS *AdvisoryCVSS `json:"cvss,omitempty"` + CvssSeverities *AdvisoryCvssSeverities `json:"cvss_severities,omitempty"` CWEs []*AdvisoryCWEs `json:"cwes,omitempty"` EPSS *AdvisoryEPSS `json:"epss,omitempty"` Identifiers []*AdvisoryIdentifier `json:"identifiers,omitempty"` diff --git a/github/event_types.go b/github/event_types.go index 2a085d47b60..c96e12600af 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -120,10 +120,9 @@ type ContentReferenceEvent struct { type CreateEvent struct { Ref *string `json:"ref,omitempty"` // RefType is the object that was created. Possible values are: "repository", "branch", "tag". - RefType *string `json:"ref_type,omitempty"` - MasterBranch *string `json:"master_branch,omitempty"` - Description *string `json:"description,omitempty"` - PusherType *string `json:"pusher_type,omitempty"` + RefType *string `json:"ref_type,omitempty"` + Description *string `json:"description,omitempty"` + PusherType *string `json:"pusher_type,omitempty"` // The following fields are only populated by Webhook events. Repo *Repository `json:"repository,omitempty"` @@ -1416,7 +1415,6 @@ type PushEventRepository struct { WatchersCount *int `json:"watchers_count,omitempty"` Language *string `json:"language,omitempty"` HasIssues *bool `json:"has_issues,omitempty"` - HasDownloads *bool `json:"has_downloads,omitempty"` HasWiki *bool `json:"has_wiki,omitempty"` HasPages *bool `json:"has_pages,omitempty"` ForksCount *int `json:"forks_count,omitempty"` @@ -1424,7 +1422,6 @@ type PushEventRepository struct { Disabled *bool `json:"disabled,omitempty"` OpenIssuesCount *int `json:"open_issues_count,omitempty"` DefaultBranch *string `json:"default_branch,omitempty"` - MasterBranch *string `json:"master_branch,omitempty"` Organization *string `json:"organization,omitempty"` URL *string `json:"url,omitempty"` ArchiveURL *string `json:"archive_url,omitempty"` @@ -1887,6 +1884,7 @@ type WorkflowRunEvent struct { // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory type SecurityAdvisory struct { CVSS *AdvisoryCVSS `json:"cvss,omitempty"` + CvssSeverities *AdvisoryCvssSeverities `json:"cvss_severities,omitempty"` CWEs []*AdvisoryCWEs `json:"cwes,omitempty"` GHSAID *string `json:"ghsa_id,omitempty"` Summary *string `json:"summary,omitempty"` diff --git a/github/event_types_test.go b/github/event_types_test.go index 74ca820a033..10ac8320d86 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -13482,11 +13482,10 @@ func TestCreateEvent_Marshal(t *testing.T) { testJSONMarshal(t, &CreateEvent{}, "{}") r := &CreateEvent{ - Ref: Ptr("r"), - RefType: Ptr("rt"), - MasterBranch: Ptr("mb"), - Description: Ptr("d"), - PusherType: Ptr("pt"), + Ref: Ptr("r"), + RefType: Ptr("rt"), + Description: Ptr("d"), + PusherType: Ptr("pt"), Repo: &Repository{ ID: Ptr(int64(1)), URL: Ptr("s"), @@ -13600,7 +13599,6 @@ func TestCreateEvent_Marshal(t *testing.T) { want := `{ "ref": "r", "ref_type": "rt", - "master_branch": "mb", "description": "d", "pusher_type": "pt", "repository": { @@ -15533,7 +15531,6 @@ func TestPushEventRepository_Marshal(t *testing.T) { WatchersCount: Ptr(1), Language: Ptr("l"), HasIssues: Ptr(true), - HasDownloads: Ptr(true), HasWiki: Ptr(true), HasPages: Ptr(true), ForksCount: Ptr(1), @@ -15541,7 +15538,6 @@ func TestPushEventRepository_Marshal(t *testing.T) { Disabled: Ptr(true), OpenIssuesCount: Ptr(1), DefaultBranch: Ptr("d"), - MasterBranch: Ptr("m"), Organization: Ptr("o"), URL: Ptr("u"), ArchiveURL: Ptr("a"), @@ -15589,7 +15585,6 @@ func TestPushEventRepository_Marshal(t *testing.T) { "watchers_count": 1, "language": "l", "has_issues": true, - "has_downloads": true, "has_wiki": true, "has_pages": true, "forks_count": 1, @@ -15597,7 +15592,6 @@ func TestPushEventRepository_Marshal(t *testing.T) { "disabled": true, "open_issues_count": 1, "default_branch": "d", - "master_branch": "m", "organization": "o", "url": "u", "archive_url": "a", @@ -18627,7 +18621,6 @@ func TestCodeScanningAlertEvent_Marshal(t *testing.T) { HasWiki: Ptr(true), HasPages: Ptr(true), HasProjects: Ptr(true), - HasDownloads: Ptr(true), URL: Ptr("a"), ArchiveURL: Ptr("a"), AssigneesURL: Ptr("a"), @@ -18812,7 +18805,6 @@ func TestCodeScanningAlertEvent_Marshal(t *testing.T) { "watchers_count": 0, "has_issues": true, "has_projects": true, - "has_downloads": true, "has_wiki": true, "has_pages": true, "forks_count": 0, diff --git a/github/github-accessors.go b/github/github-accessors.go index b529e5e4675..72627908613 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -502,6 +502,22 @@ func (a *AdvisoryCVSS) GetVectorString() string { return *a.VectorString } +// GetCvssV3 returns the CvssV3 field. +func (a *AdvisoryCvssSeverities) GetCvssV3() *AdvisoryCVSS { + if a == nil { + return nil + } + return a.CvssV3 +} + +// GetCvssV4 returns the CvssV4 field. +func (a *AdvisoryCvssSeverities) GetCvssV4() *AdvisoryCVSS { + if a == nil { + return nil + } + return a.CvssV4 +} + // GetCWEID returns the CWEID field if it's non-nil, zero value otherwise. func (a *AdvisoryCWEs) GetCWEID() string { if a == nil || a.CWEID == nil { @@ -1502,6 +1518,14 @@ func (a *Attachment) GetTitle() string { return *a.Title } +// GetBundleURL returns the BundleURL field if it's non-nil, zero value otherwise. +func (a *Attestation) GetBundleURL() string { + if a == nil || a.BundleURL == nil { + return "" + } + return *a.BundleURL +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetAction() string { if a == nil || a.Action == nil { @@ -6918,14 +6942,6 @@ func (c *CreateEvent) GetInstallation() *Installation { return c.Installation } -// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise. -func (c *CreateEvent) GetMasterBranch() string { - if c == nil || c.MasterBranch == nil { - return "" - } - return *c.MasterBranch -} - // GetOrg returns the Org field. func (c *CreateEvent) GetOrg() *Organization { if c == nil { @@ -8022,6 +8038,14 @@ func (d *DependabotSecurityAdvisory) GetCVSS() *AdvisoryCVSS { return d.CVSS } +// GetCvssSeverities returns the CvssSeverities field. +func (d *DependabotSecurityAdvisory) GetCvssSeverities() *AdvisoryCvssSeverities { + if d == nil { + return nil + } + return d.CvssSeverities +} + // GetDescription returns the Description field if it's non-nil, zero value otherwise. func (d *DependabotSecurityAdvisory) GetDescription() string { if d == nil || d.Description == nil { @@ -13278,14 +13302,6 @@ func (i *Issue) GetActiveLockReason() string { return *i.ActiveLockReason } -// GetAssignee returns the Assignee field. -func (i *Issue) GetAssignee() *User { - if i == nil { - return nil - } - return i.Assignee -} - // GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. func (i *Issue) GetAuthorAssociation() string { if i == nil || i.AuthorAssociation == nil { @@ -13998,14 +14014,6 @@ func (i *IssueListCommentsOptions) GetSort() string { return *i.Sort } -// GetAssignee returns the Assignee field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetAssignee() string { - if i == nil || i.Assignee == nil { - return "" - } - return *i.Assignee -} - // GetAssignees returns the Assignees field if it's non-nil, zero value otherwise. func (i *IssueRequest) GetAssignees() []string { if i == nil || i.Assignees == nil { @@ -16686,14 +16694,6 @@ func (n *NewTeam) GetParentTeamID() int64 { return *n.ParentTeamID } -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetPermission() string { - if n == nil || n.Permission == nil { - return "" - } - return *n.Permission -} - // GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise. func (n *NewTeam) GetPrivacy() string { if n == nil || n.Privacy == nil { @@ -21134,14 +21134,6 @@ func (p *PullRequest) GetAdditions() int { return *p.Additions } -// GetAssignee returns the Assignee field. -func (p *PullRequest) GetAssignee() *User { - if p == nil { - return nil - } - return p.Assignee -} - // GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. func (p *PullRequest) GetAuthorAssociation() string { if p == nil || p.AuthorAssociation == nil { @@ -21326,14 +21318,6 @@ func (p *PullRequest) GetMergeableState() string { return *p.MergeableState } -// GetMergeCommitSHA returns the MergeCommitSHA field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetMergeCommitSHA() string { - if p == nil || p.MergeCommitSHA == nil { - return "" - } - return *p.MergeCommitSHA -} - // GetMerged returns the Merged field if it's non-nil, zero value otherwise. func (p *PullRequest) GetMerged() bool { if p == nil || p.Merged == nil { @@ -22814,14 +22798,6 @@ func (p *PushEventRepository) GetGitURL() string { return *p.GitURL } -// GetHasDownloads returns the HasDownloads field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetHasDownloads() bool { - if p == nil || p.HasDownloads == nil { - return false - } - return *p.HasDownloads -} - // GetHasIssues returns the HasIssues field if it's non-nil, zero value otherwise. func (p *PushEventRepository) GetHasIssues() bool { if p == nil || p.HasIssues == nil { @@ -22878,14 +22854,6 @@ func (p *PushEventRepository) GetLanguage() string { return *p.Language } -// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetMasterBranch() string { - if p == nil || p.MasterBranch == nil { - return "" - } - return *p.MasterBranch -} - // GetName returns the Name field if it's non-nil, zero value otherwise. func (p *PushEventRepository) GetName() string { if p == nil || p.Name == nil { @@ -24118,14 +24086,6 @@ func (r *Repository) GetHasDiscussions() bool { return *r.HasDiscussions } -// GetHasDownloads returns the HasDownloads field if it's non-nil, zero value otherwise. -func (r *Repository) GetHasDownloads() bool { - if r == nil || r.HasDownloads == nil { - return false - } - return *r.HasDownloads -} - // GetHasIssues returns the HasIssues field if it's non-nil, zero value otherwise. func (r *Repository) GetHasIssues() bool { if r == nil || r.HasIssues == nil { @@ -24270,14 +24230,6 @@ func (r *Repository) GetLicenseTemplate() string { return *r.LicenseTemplate } -// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise. -func (r *Repository) GetMasterBranch() string { - if r == nil || r.MasterBranch == nil { - return "" - } - return *r.MasterBranch -} - // GetMergeCommitMessage returns the MergeCommitMessage field if it's non-nil, zero value otherwise. func (r *Repository) GetMergeCommitMessage() string { if r == nil || r.MergeCommitMessage == nil { @@ -24598,14 +24550,6 @@ func (r *Repository) GetURL() string { return *r.URL } -// GetUseSquashPRTitleAsDefault returns the UseSquashPRTitleAsDefault field if it's non-nil, zero value otherwise. -func (r *Repository) GetUseSquashPRTitleAsDefault() bool { - if r == nil || r.UseSquashPRTitleAsDefault == nil { - return false - } - return *r.UseSquashPRTitleAsDefault -} - // GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. func (r *Repository) GetVisibility() string { if r == nil || r.Visibility == nil { @@ -28318,6 +28262,14 @@ func (s *SecurityAdvisory) GetCVSS() *AdvisoryCVSS { return s.CVSS } +// GetCvssSeverities returns the CvssSeverities field. +func (s *SecurityAdvisory) GetCvssSeverities() *AdvisoryCvssSeverities { + if s == nil { + return nil + } + return s.CvssSeverities +} + // GetDescription returns the Description field if it's non-nil, zero value otherwise. func (s *SecurityAdvisory) GetDescription() string { if s == nil || s.Description == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 84aa1a4190e..c4875476670 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -641,6 +641,22 @@ func TestAdvisoryCVSS_GetVectorString(tt *testing.T) { a.GetVectorString() } +func TestAdvisoryCvssSeverities_GetCvssV3(tt *testing.T) { + tt.Parallel() + a := &AdvisoryCvssSeverities{} + a.GetCvssV3() + a = nil + a.GetCvssV3() +} + +func TestAdvisoryCvssSeverities_GetCvssV4(tt *testing.T) { + tt.Parallel() + a := &AdvisoryCvssSeverities{} + a.GetCvssV4() + a = nil + a.GetCvssV4() +} + func TestAdvisoryCWEs_GetCWEID(tt *testing.T) { tt.Parallel() var zeroValue string @@ -1971,6 +1987,17 @@ func TestAttachment_GetTitle(tt *testing.T) { a.GetTitle() } +func TestAttestation_GetBundleURL(tt *testing.T) { + tt.Parallel() + var zeroValue string + a := &Attestation{BundleURL: &zeroValue} + a.GetBundleURL() + a = &Attestation{} + a.GetBundleURL() + a = nil + a.GetBundleURL() +} + func TestAuditEntry_GetAction(tt *testing.T) { tt.Parallel() var zeroValue string @@ -9055,17 +9082,6 @@ func TestCreateEvent_GetInstallation(tt *testing.T) { c.GetInstallation() } -func TestCreateEvent_GetMasterBranch(tt *testing.T) { - tt.Parallel() - var zeroValue string - c := &CreateEvent{MasterBranch: &zeroValue} - c.GetMasterBranch() - c = &CreateEvent{} - c.GetMasterBranch() - c = nil - c.GetMasterBranch() -} - func TestCreateEvent_GetOrg(tt *testing.T) { tt.Parallel() c := &CreateEvent{} @@ -10468,6 +10484,14 @@ func TestDependabotSecurityAdvisory_GetCVSS(tt *testing.T) { d.GetCVSS() } +func TestDependabotSecurityAdvisory_GetCvssSeverities(tt *testing.T) { + tt.Parallel() + d := &DependabotSecurityAdvisory{} + d.GetCvssSeverities() + d = nil + d.GetCvssSeverities() +} + func TestDependabotSecurityAdvisory_GetDescription(tt *testing.T) { tt.Parallel() var zeroValue string @@ -17296,14 +17320,6 @@ func TestIssue_GetActiveLockReason(tt *testing.T) { i.GetActiveLockReason() } -func TestIssue_GetAssignee(tt *testing.T) { - tt.Parallel() - i := &Issue{} - i.GetAssignee() - i = nil - i.GetAssignee() -} - func TestIssue_GetAuthorAssociation(tt *testing.T) { tt.Parallel() var zeroValue string @@ -18196,17 +18212,6 @@ func TestIssueListCommentsOptions_GetSort(tt *testing.T) { i.GetSort() } -func TestIssueRequest_GetAssignee(tt *testing.T) { - tt.Parallel() - var zeroValue string - i := &IssueRequest{Assignee: &zeroValue} - i.GetAssignee() - i = &IssueRequest{} - i.GetAssignee() - i = nil - i.GetAssignee() -} - func TestIssueRequest_GetAssignees(tt *testing.T) { tt.Parallel() var zeroValue []string @@ -21697,17 +21702,6 @@ func TestNewTeam_GetParentTeamID(tt *testing.T) { n.GetParentTeamID() } -func TestNewTeam_GetPermission(tt *testing.T) { - tt.Parallel() - var zeroValue string - n := &NewTeam{Permission: &zeroValue} - n.GetPermission() - n = &NewTeam{} - n.GetPermission() - n = nil - n.GetPermission() -} - func TestNewTeam_GetPrivacy(tt *testing.T) { tt.Parallel() var zeroValue string @@ -27396,14 +27390,6 @@ func TestPullRequest_GetAdditions(tt *testing.T) { p.GetAdditions() } -func TestPullRequest_GetAssignee(tt *testing.T) { - tt.Parallel() - p := &PullRequest{} - p.GetAssignee() - p = nil - p.GetAssignee() -} - func TestPullRequest_GetAuthorAssociation(tt *testing.T) { tt.Parallel() var zeroValue string @@ -27645,17 +27631,6 @@ func TestPullRequest_GetMergeableState(tt *testing.T) { p.GetMergeableState() } -func TestPullRequest_GetMergeCommitSHA(tt *testing.T) { - tt.Parallel() - var zeroValue string - p := &PullRequest{MergeCommitSHA: &zeroValue} - p.GetMergeCommitSHA() - p = &PullRequest{} - p.GetMergeCommitSHA() - p = nil - p.GetMergeCommitSHA() -} - func TestPullRequest_GetMerged(tt *testing.T) { tt.Parallel() var zeroValue bool @@ -29505,17 +29480,6 @@ func TestPushEventRepository_GetGitURL(tt *testing.T) { p.GetGitURL() } -func TestPushEventRepository_GetHasDownloads(tt *testing.T) { - tt.Parallel() - var zeroValue bool - p := &PushEventRepository{HasDownloads: &zeroValue} - p.GetHasDownloads() - p = &PushEventRepository{} - p.GetHasDownloads() - p = nil - p.GetHasDownloads() -} - func TestPushEventRepository_GetHasIssues(tt *testing.T) { tt.Parallel() var zeroValue bool @@ -29593,17 +29557,6 @@ func TestPushEventRepository_GetLanguage(tt *testing.T) { p.GetLanguage() } -func TestPushEventRepository_GetMasterBranch(tt *testing.T) { - tt.Parallel() - var zeroValue string - p := &PushEventRepository{MasterBranch: &zeroValue} - p.GetMasterBranch() - p = &PushEventRepository{} - p.GetMasterBranch() - p = nil - p.GetMasterBranch() -} - func TestPushEventRepository_GetName(tt *testing.T) { tt.Parallel() var zeroValue string @@ -31211,17 +31164,6 @@ func TestRepository_GetHasDiscussions(tt *testing.T) { r.GetHasDiscussions() } -func TestRepository_GetHasDownloads(tt *testing.T) { - tt.Parallel() - var zeroValue bool - r := &Repository{HasDownloads: &zeroValue} - r.GetHasDownloads() - r = &Repository{} - r.GetHasDownloads() - r = nil - r.GetHasDownloads() -} - func TestRepository_GetHasIssues(tt *testing.T) { tt.Parallel() var zeroValue bool @@ -31417,17 +31359,6 @@ func TestRepository_GetLicenseTemplate(tt *testing.T) { r.GetLicenseTemplate() } -func TestRepository_GetMasterBranch(tt *testing.T) { - tt.Parallel() - var zeroValue string - r := &Repository{MasterBranch: &zeroValue} - r.GetMasterBranch() - r = &Repository{} - r.GetMasterBranch() - r = nil - r.GetMasterBranch() -} - func TestRepository_GetMergeCommitMessage(tt *testing.T) { tt.Parallel() var zeroValue string @@ -31847,17 +31778,6 @@ func TestRepository_GetURL(tt *testing.T) { r.GetURL() } -func TestRepository_GetUseSquashPRTitleAsDefault(tt *testing.T) { - tt.Parallel() - var zeroValue bool - r := &Repository{UseSquashPRTitleAsDefault: &zeroValue} - r.GetUseSquashPRTitleAsDefault() - r = &Repository{} - r.GetUseSquashPRTitleAsDefault() - r = nil - r.GetUseSquashPRTitleAsDefault() -} - func TestRepository_GetVisibility(tt *testing.T) { tt.Parallel() var zeroValue string @@ -36569,6 +36489,14 @@ func TestSecurityAdvisory_GetCVSS(tt *testing.T) { s.GetCVSS() } +func TestSecurityAdvisory_GetCvssSeverities(tt *testing.T) { + tt.Parallel() + s := &SecurityAdvisory{} + s.GetCvssSeverities() + s = nil + s.GetCvssSeverities() +} + func TestSecurityAdvisory_GetDescription(tt *testing.T) { tt.Parallel() var zeroValue string diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 98cdbbf9d0c..052f50322d2 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -937,7 +937,6 @@ func TestIssue_String(t *testing.T) { Body: Ptr(""), AuthorAssociation: Ptr(""), User: &User{}, - Assignee: &User{}, Comments: Ptr(0), ClosedAt: &Timestamp{}, CreatedAt: &Timestamp{}, @@ -959,7 +958,7 @@ func TestIssue_String(t *testing.T) { Type: &IssueType{}, ActiveLockReason: Ptr(""), } - want := `github.Issue{ID:0, Number:0, State:"", StateReason:"", Locked:false, Title:"", Body:"", AuthorAssociation:"", User:github.User{}, Assignee:github.User{}, Comments:0, ClosedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, ClosedBy:github.User{}, URL:"", HTMLURL:"", CommentsURL:"", EventsURL:"", LabelsURL:"", RepositoryURL:"", ParentIssueURL:"", Milestone:github.Milestone{}, PullRequestLinks:github.PullRequestLinks{}, Repository:github.Repository{}, Reactions:github.Reactions{}, NodeID:"", Draft:false, Type:github.IssueType{}, ActiveLockReason:""}` + want := `github.Issue{ID:0, Number:0, State:"", StateReason:"", Locked:false, Title:"", Body:"", AuthorAssociation:"", User:github.User{}, Comments:0, ClosedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, ClosedBy:github.User{}, URL:"", HTMLURL:"", CommentsURL:"", EventsURL:"", LabelsURL:"", RepositoryURL:"", ParentIssueURL:"", Milestone:github.Milestone{}, PullRequestLinks:github.PullRequestLinks{}, Repository:github.Repository{}, Reactions:github.Reactions{}, NodeID:"", Draft:false, Type:github.IssueType{}, ActiveLockReason:""}` if got := v.String(); got != want { t.Errorf("Issue.String = %v, want %v", got, want) } @@ -1167,11 +1166,10 @@ func TestNewTeam_String(t *testing.T) { RepoNames: []string{""}, ParentTeamID: Ptr(int64(0)), NotificationSetting: Ptr(""), - Permission: Ptr(""), Privacy: Ptr(""), LDAPDN: Ptr(""), } - want := `github.NewTeam{Name:"", Description:"", Maintainers:[""], RepoNames:[""], ParentTeamID:0, NotificationSetting:"", Permission:"", Privacy:"", LDAPDN:""}` + want := `github.NewTeam{Name:"", Description:"", Maintainers:[""], RepoNames:[""], ParentTeamID:0, NotificationSetting:"", Privacy:"", LDAPDN:""}` if got := v.String(); got != want { t.Errorf("NewTeam.String = %v, want %v", got, want) } @@ -1621,7 +1619,6 @@ func TestPullRequest_String(t *testing.T) { CommentsURL: Ptr(""), ReviewCommentsURL: Ptr(""), ReviewCommentURL: Ptr(""), - Assignee: &User{}, Milestone: &Milestone{}, AuthorAssociation: Ptr(""), NodeID: Ptr(""), @@ -1631,7 +1628,6 @@ func TestPullRequest_String(t *testing.T) { MergeableState: Ptr(""), Rebaseable: Ptr(false), MergedBy: &User{}, - MergeCommitSHA: Ptr(""), Comments: Ptr(0), Commits: Ptr(0), Additions: Ptr(0), @@ -1644,7 +1640,7 @@ func TestPullRequest_String(t *testing.T) { Base: &PullRequestBranch{}, ActiveLockReason: Ptr(""), } - want := `github.PullRequest{ID:0, Number:0, State:"", Locked:false, Title:"", Body:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, ClosedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, MergedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, User:github.User{}, Draft:false, URL:"", HTMLURL:"", IssueURL:"", StatusesURL:"", DiffURL:"", PatchURL:"", CommitsURL:"", CommentsURL:"", ReviewCommentsURL:"", ReviewCommentURL:"", Assignee:github.User{}, Milestone:github.Milestone{}, AuthorAssociation:"", NodeID:"", AutoMerge:github.PullRequestAutoMerge{}, Merged:false, Mergeable:false, MergeableState:"", Rebaseable:false, MergedBy:github.User{}, MergeCommitSHA:"", Comments:0, Commits:0, Additions:0, Deletions:0, ChangedFiles:0, MaintainerCanModify:false, ReviewComments:0, Links:github.PRLinks{}, Head:github.PullRequestBranch{}, Base:github.PullRequestBranch{}, ActiveLockReason:""}` + want := `github.PullRequest{ID:0, Number:0, State:"", Locked:false, Title:"", Body:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, ClosedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, MergedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, User:github.User{}, Draft:false, URL:"", HTMLURL:"", IssueURL:"", StatusesURL:"", DiffURL:"", PatchURL:"", CommitsURL:"", CommentsURL:"", ReviewCommentsURL:"", ReviewCommentURL:"", Milestone:github.Milestone{}, AuthorAssociation:"", NodeID:"", AutoMerge:github.PullRequestAutoMerge{}, Merged:false, Mergeable:false, MergeableState:"", Rebaseable:false, MergedBy:github.User{}, Comments:0, Commits:0, Additions:0, Deletions:0, ChangedFiles:0, MaintainerCanModify:false, ReviewComments:0, Links:github.PRLinks{}, Head:github.PullRequestBranch{}, Base:github.PullRequestBranch{}, ActiveLockReason:""}` if got := v.String(); got != want { t.Errorf("PullRequest.String = %v, want %v", got, want) } @@ -1906,112 +1902,109 @@ func TestRepoStatus_String(t *testing.T) { func TestRepository_String(t *testing.T) { t.Parallel() v := Repository{ - ID: Ptr(int64(0)), - NodeID: Ptr(""), - Owner: &User{}, - Name: Ptr(""), - FullName: Ptr(""), - Description: Ptr(""), - Homepage: Ptr(""), - CodeOfConduct: &CodeOfConduct{}, - DefaultBranch: Ptr(""), - MasterBranch: Ptr(""), - CreatedAt: &Timestamp{}, - PushedAt: &Timestamp{}, - UpdatedAt: &Timestamp{}, - HTMLURL: Ptr(""), - CloneURL: Ptr(""), - GitURL: Ptr(""), - MirrorURL: Ptr(""), - SSHURL: Ptr(""), - SVNURL: Ptr(""), - Language: Ptr(""), - Fork: Ptr(false), - ForksCount: Ptr(0), - NetworkCount: Ptr(0), - OpenIssuesCount: Ptr(0), - OpenIssues: Ptr(0), - StargazersCount: Ptr(0), - SubscribersCount: Ptr(0), - WatchersCount: Ptr(0), - Watchers: Ptr(0), - Size: Ptr(0), - AutoInit: Ptr(false), - Parent: &Repository{}, - Source: &Repository{}, - TemplateRepository: &Repository{}, - Organization: &Organization{}, - Permissions: &RepositoryPermissions{}, - AllowRebaseMerge: Ptr(false), - AllowUpdateBranch: Ptr(false), - AllowSquashMerge: Ptr(false), - AllowMergeCommit: Ptr(false), - AllowAutoMerge: Ptr(false), - AllowForking: Ptr(false), - WebCommitSignoffRequired: Ptr(false), - DeleteBranchOnMerge: Ptr(false), - UseSquashPRTitleAsDefault: Ptr(false), - SquashMergeCommitTitle: Ptr(""), - SquashMergeCommitMessage: Ptr(""), - MergeCommitTitle: Ptr(""), - MergeCommitMessage: Ptr(""), - Topics: []string{""}, - Archived: Ptr(false), - Disabled: Ptr(false), - License: &License{}, - Private: Ptr(false), - HasIssues: Ptr(false), - HasWiki: Ptr(false), - HasPages: Ptr(false), - HasProjects: Ptr(false), - HasDownloads: Ptr(false), - HasDiscussions: Ptr(false), - IsTemplate: Ptr(false), - LicenseTemplate: Ptr(""), - GitignoreTemplate: Ptr(""), - SecurityAndAnalysis: &SecurityAndAnalysis{}, - TeamID: Ptr(int64(0)), - URL: Ptr(""), - ArchiveURL: Ptr(""), - AssigneesURL: Ptr(""), - BlobsURL: Ptr(""), - BranchesURL: Ptr(""), - CollaboratorsURL: Ptr(""), - CommentsURL: Ptr(""), - CommitsURL: Ptr(""), - CompareURL: Ptr(""), - ContentsURL: Ptr(""), - ContributorsURL: Ptr(""), - DeploymentsURL: Ptr(""), - DownloadsURL: Ptr(""), - EventsURL: Ptr(""), - ForksURL: Ptr(""), - GitCommitsURL: Ptr(""), - GitRefsURL: Ptr(""), - GitTagsURL: Ptr(""), - HooksURL: Ptr(""), - IssueCommentURL: Ptr(""), - IssueEventsURL: Ptr(""), - IssuesURL: Ptr(""), - KeysURL: Ptr(""), - LabelsURL: Ptr(""), - LanguagesURL: Ptr(""), - MergesURL: Ptr(""), - MilestonesURL: Ptr(""), - NotificationsURL: Ptr(""), - PullsURL: Ptr(""), - ReleasesURL: Ptr(""), - StargazersURL: Ptr(""), - StatusesURL: Ptr(""), - SubscribersURL: Ptr(""), - SubscriptionURL: Ptr(""), - TagsURL: Ptr(""), - TreesURL: Ptr(""), - TeamsURL: Ptr(""), - Visibility: Ptr(""), - RoleName: Ptr(""), - } - want := `github.Repository{ID:0, NodeID:"", Owner:github.User{}, Name:"", FullName:"", Description:"", Homepage:"", CodeOfConduct:github.CodeOfConduct{}, DefaultBranch:"", MasterBranch:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, PushedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, HTMLURL:"", CloneURL:"", GitURL:"", MirrorURL:"", SSHURL:"", SVNURL:"", Language:"", Fork:false, ForksCount:0, NetworkCount:0, OpenIssuesCount:0, OpenIssues:0, StargazersCount:0, SubscribersCount:0, WatchersCount:0, Watchers:0, Size:0, AutoInit:false, Parent:github.Repository{}, Source:github.Repository{}, TemplateRepository:github.Repository{}, Organization:github.Organization{}, Permissions:github.RepositoryPermissions{}, AllowRebaseMerge:false, AllowUpdateBranch:false, AllowSquashMerge:false, AllowMergeCommit:false, AllowAutoMerge:false, AllowForking:false, WebCommitSignoffRequired:false, DeleteBranchOnMerge:false, UseSquashPRTitleAsDefault:false, SquashMergeCommitTitle:"", SquashMergeCommitMessage:"", MergeCommitTitle:"", MergeCommitMessage:"", Topics:[""], Archived:false, Disabled:false, License:github.License{}, Private:false, HasIssues:false, HasWiki:false, HasPages:false, HasProjects:false, HasDownloads:false, HasDiscussions:false, IsTemplate:false, LicenseTemplate:"", GitignoreTemplate:"", SecurityAndAnalysis:github.SecurityAndAnalysis{}, TeamID:0, URL:"", ArchiveURL:"", AssigneesURL:"", BlobsURL:"", BranchesURL:"", CollaboratorsURL:"", CommentsURL:"", CommitsURL:"", CompareURL:"", ContentsURL:"", ContributorsURL:"", DeploymentsURL:"", DownloadsURL:"", EventsURL:"", ForksURL:"", GitCommitsURL:"", GitRefsURL:"", GitTagsURL:"", HooksURL:"", IssueCommentURL:"", IssueEventsURL:"", IssuesURL:"", KeysURL:"", LabelsURL:"", LanguagesURL:"", MergesURL:"", MilestonesURL:"", NotificationsURL:"", PullsURL:"", ReleasesURL:"", StargazersURL:"", StatusesURL:"", SubscribersURL:"", SubscriptionURL:"", TagsURL:"", TreesURL:"", TeamsURL:"", Visibility:"", RoleName:""}` + ID: Ptr(int64(0)), + NodeID: Ptr(""), + Owner: &User{}, + Name: Ptr(""), + FullName: Ptr(""), + Description: Ptr(""), + Homepage: Ptr(""), + CodeOfConduct: &CodeOfConduct{}, + DefaultBranch: Ptr(""), + CreatedAt: &Timestamp{}, + PushedAt: &Timestamp{}, + UpdatedAt: &Timestamp{}, + HTMLURL: Ptr(""), + CloneURL: Ptr(""), + GitURL: Ptr(""), + MirrorURL: Ptr(""), + SSHURL: Ptr(""), + SVNURL: Ptr(""), + Language: Ptr(""), + Fork: Ptr(false), + ForksCount: Ptr(0), + NetworkCount: Ptr(0), + OpenIssuesCount: Ptr(0), + OpenIssues: Ptr(0), + StargazersCount: Ptr(0), + SubscribersCount: Ptr(0), + WatchersCount: Ptr(0), + Watchers: Ptr(0), + Size: Ptr(0), + AutoInit: Ptr(false), + Parent: &Repository{}, + Source: &Repository{}, + TemplateRepository: &Repository{}, + Organization: &Organization{}, + Permissions: &RepositoryPermissions{}, + AllowRebaseMerge: Ptr(false), + AllowUpdateBranch: Ptr(false), + AllowSquashMerge: Ptr(false), + AllowMergeCommit: Ptr(false), + AllowAutoMerge: Ptr(false), + AllowForking: Ptr(false), + WebCommitSignoffRequired: Ptr(false), + DeleteBranchOnMerge: Ptr(false), + SquashMergeCommitTitle: Ptr(""), + SquashMergeCommitMessage: Ptr(""), + MergeCommitTitle: Ptr(""), + MergeCommitMessage: Ptr(""), + Topics: []string{""}, + Archived: Ptr(false), + Disabled: Ptr(false), + License: &License{}, + Private: Ptr(false), + HasIssues: Ptr(false), + HasWiki: Ptr(false), + HasPages: Ptr(false), + HasProjects: Ptr(false), + HasDiscussions: Ptr(false), + IsTemplate: Ptr(false), + LicenseTemplate: Ptr(""), + GitignoreTemplate: Ptr(""), + SecurityAndAnalysis: &SecurityAndAnalysis{}, + TeamID: Ptr(int64(0)), + URL: Ptr(""), + ArchiveURL: Ptr(""), + AssigneesURL: Ptr(""), + BlobsURL: Ptr(""), + BranchesURL: Ptr(""), + CollaboratorsURL: Ptr(""), + CommentsURL: Ptr(""), + CommitsURL: Ptr(""), + CompareURL: Ptr(""), + ContentsURL: Ptr(""), + ContributorsURL: Ptr(""), + DeploymentsURL: Ptr(""), + DownloadsURL: Ptr(""), + EventsURL: Ptr(""), + ForksURL: Ptr(""), + GitCommitsURL: Ptr(""), + GitRefsURL: Ptr(""), + GitTagsURL: Ptr(""), + HooksURL: Ptr(""), + IssueCommentURL: Ptr(""), + IssueEventsURL: Ptr(""), + IssuesURL: Ptr(""), + KeysURL: Ptr(""), + LabelsURL: Ptr(""), + LanguagesURL: Ptr(""), + MergesURL: Ptr(""), + MilestonesURL: Ptr(""), + NotificationsURL: Ptr(""), + PullsURL: Ptr(""), + ReleasesURL: Ptr(""), + StargazersURL: Ptr(""), + StatusesURL: Ptr(""), + SubscribersURL: Ptr(""), + SubscriptionURL: Ptr(""), + TagsURL: Ptr(""), + TreesURL: Ptr(""), + TeamsURL: Ptr(""), + Visibility: Ptr(""), + RoleName: Ptr(""), + } + want := `github.Repository{ID:0, NodeID:"", Owner:github.User{}, Name:"", FullName:"", Description:"", Homepage:"", CodeOfConduct:github.CodeOfConduct{}, DefaultBranch:"", CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, PushedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, HTMLURL:"", CloneURL:"", GitURL:"", MirrorURL:"", SSHURL:"", SVNURL:"", Language:"", Fork:false, ForksCount:0, NetworkCount:0, OpenIssuesCount:0, OpenIssues:0, StargazersCount:0, SubscribersCount:0, WatchersCount:0, Watchers:0, Size:0, AutoInit:false, Parent:github.Repository{}, Source:github.Repository{}, TemplateRepository:github.Repository{}, Organization:github.Organization{}, Permissions:github.RepositoryPermissions{}, AllowRebaseMerge:false, AllowUpdateBranch:false, AllowSquashMerge:false, AllowMergeCommit:false, AllowAutoMerge:false, AllowForking:false, WebCommitSignoffRequired:false, DeleteBranchOnMerge:false, SquashMergeCommitTitle:"", SquashMergeCommitMessage:"", MergeCommitTitle:"", MergeCommitMessage:"", Topics:[""], Archived:false, Disabled:false, License:github.License{}, Private:false, HasIssues:false, HasWiki:false, HasPages:false, HasProjects:false, HasDiscussions:false, IsTemplate:false, LicenseTemplate:"", GitignoreTemplate:"", SecurityAndAnalysis:github.SecurityAndAnalysis{}, TeamID:0, URL:"", ArchiveURL:"", AssigneesURL:"", BlobsURL:"", BranchesURL:"", CollaboratorsURL:"", CommentsURL:"", CommitsURL:"", CompareURL:"", ContentsURL:"", ContributorsURL:"", DeploymentsURL:"", DownloadsURL:"", EventsURL:"", ForksURL:"", GitCommitsURL:"", GitRefsURL:"", GitTagsURL:"", HooksURL:"", IssueCommentURL:"", IssueEventsURL:"", IssuesURL:"", KeysURL:"", LabelsURL:"", LanguagesURL:"", MergesURL:"", MilestonesURL:"", NotificationsURL:"", PullsURL:"", ReleasesURL:"", StargazersURL:"", StatusesURL:"", SubscribersURL:"", SubscriptionURL:"", TagsURL:"", TreesURL:"", TeamsURL:"", Visibility:"", RoleName:""}` if got := v.String(); got != want { t.Errorf("Repository.String = %v, want %v", got, want) } diff --git a/github/github.go b/github/github.go index 53b0c9003d1..32c2317a849 100644 --- a/github/github.go +++ b/github/github.go @@ -38,7 +38,7 @@ const ( HeaderRateUsed = "X-Ratelimit-Used" HeaderRequestID = "X-Github-Request-Id" - defaultAPIVersion = "2022-11-28" + defaultAPIVersion = "2026-03-10" defaultBaseURL = "https://api.github.com/" defaultUserAgent = "go-github" + "/" + Version uploadBaseURL = "https://uploads.github.com/" diff --git a/github/issues.go b/github/issues.go index c31bebe459c..fb258bef2b7 100644 --- a/github/issues.go +++ b/github/issues.go @@ -42,7 +42,6 @@ type Issue struct { AuthorAssociation *string `json:"author_association,omitempty"` User *User `json:"user,omitempty"` Labels []*Label `json:"labels,omitempty"` - Assignee *User `json:"assignee,omitempty"` Comments *int `json:"comments,omitempty"` ClosedAt *Timestamp `json:"closed_at,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` @@ -86,12 +85,11 @@ func (i Issue) IsPullRequest() bool { // IssueRequest represents a request to create/edit an issue. // It is separate from Issue above because otherwise Labels -// and Assignee fail to serialize to the correct JSON. +// and Assignees fail to serialize to the correct JSON. type IssueRequest struct { Title *string `json:"title,omitempty"` Body *string `json:"body,omitempty"` Labels *[]string `json:"labels,omitempty"` - Assignee *string `json:"assignee,omitempty"` State *string `json:"state,omitempty"` // StateReason can be 'completed' or 'not_planned'. StateReason *string `json:"state_reason,omitempty"` diff --git a/github/issues_test.go b/github/issues_test.go index ff5b7377300..47d16645ce6 100644 --- a/github/issues_test.go +++ b/github/issues_test.go @@ -300,10 +300,9 @@ func TestIssuesService_Create(t *testing.T) { client, mux, _ := setup(t) input := &IssueRequest{ - Title: Ptr("t"), - Body: Ptr("b"), - Assignee: Ptr("a"), - Labels: &[]string{"l1", "l2"}, + Title: Ptr("t"), + Body: Ptr("b"), + Labels: &[]string{"l1", "l2"}, } mux.HandleFunc("/repos/o/r/issues", func(w http.ResponseWriter, r *http.Request) { @@ -568,7 +567,6 @@ func TestIssueRequest_Marshal(t *testing.T) { Title: Ptr("url"), Body: Ptr("url"), Labels: &[]string{"l"}, - Assignee: Ptr("url"), State: Ptr("url"), Milestone: Ptr(1), Assignees: &[]string{"a"}, @@ -581,7 +579,6 @@ func TestIssueRequest_Marshal(t *testing.T) { "labels": [ "l" ], - "assignee": "url", "state": "url", "milestone": 1, "assignees": [ @@ -607,7 +604,6 @@ func TestIssue_Marshal(t *testing.T) { AuthorAssociation: Ptr("aa"), User: &User{ID: Ptr(int64(1))}, Labels: []*Label{{ID: Ptr(int64(1))}}, - Assignee: &User{ID: Ptr(int64(1))}, Comments: Ptr(1), ClosedAt: &Timestamp{referenceTime}, CreatedAt: &Timestamp{referenceTime}, @@ -647,9 +643,6 @@ func TestIssue_Marshal(t *testing.T) { "id": 1 } ], - "assignee": { - "id": 1 - }, "comments": 1, "closed_at": ` + referenceTimeStr + `, "created_at": ` + referenceTimeStr + `, diff --git a/github/orgs_attestations_test.go b/github/orgs_attestations_test.go index a0ed59c9f0e..050e4a8453f 100644 --- a/github/orgs_attestations_test.go +++ b/github/orgs_attestations_test.go @@ -23,11 +23,11 @@ func TestOrganizationsService_ListAttestations(t *testing.T) { "attestations": [ { "repository_id": 1, - "bundle": {} + "bundle_url": "https://example.com/bundle/1" }, { "repository_id": 2, - "bundle": {} + "bundle_url": "https://example.com/bundle/2" } ] }`) @@ -42,11 +42,11 @@ func TestOrganizationsService_ListAttestations(t *testing.T) { Attestations: []*Attestation{ { RepositoryID: 1, - Bundle: []byte(`{}`), + BundleURL: Ptr("https://example.com/bundle/1"), }, { RepositoryID: 2, - Bundle: []byte(`{}`), + BundleURL: Ptr("https://example.com/bundle/2"), }, }, } diff --git a/github/projects_test.go b/github/projects_test.go index 746d95fbafa..2da09747a3b 100644 --- a/github/projects_test.go +++ b/github/projects_test.go @@ -1378,7 +1378,6 @@ func TestProjectV2Item_UnmarshalJSON_PullRequest(t *testing.T) { "title": "Test PR", "state": "closed", "merged": true, - "merge_commit_sha": "abc123", "head": { "ref": "feature-branch", "sha": "def456" @@ -1420,9 +1419,6 @@ func TestProjectV2Item_UnmarshalJSON_PullRequest(t *testing.T) { if !item.GetContent().GetPullRequest().GetMerged() { t.Errorf("PullRequest.Merged = %t, want true", item.GetContent().GetPullRequest().GetMerged()) } - if item.GetContent().GetPullRequest().GetMergeCommitSHA() != "abc123" { - t.Errorf("PullRequest.MergeCommitSHA = %v, want abc123", item.GetContent().GetPullRequest().GetMergeCommitSHA()) - } // Verify other content types are nil if item.GetContent().GetIssue() != nil { diff --git a/github/pulls.go b/github/pulls.go index aefd08a6dde..5e60ad9d24d 100644 --- a/github/pulls.go +++ b/github/pulls.go @@ -51,7 +51,6 @@ type PullRequest struct { CommentsURL *string `json:"comments_url,omitempty"` ReviewCommentsURL *string `json:"review_comments_url,omitempty"` ReviewCommentURL *string `json:"review_comment_url,omitempty"` - Assignee *User `json:"assignee,omitempty"` Assignees []*User `json:"assignees,omitempty"` Milestone *Milestone `json:"milestone,omitempty"` // AuthorAssociation is the pull request author's relationship to the repository. @@ -71,7 +70,6 @@ type PullRequest struct { MergeableState *string `json:"mergeable_state,omitempty"` Rebaseable *bool `json:"rebaseable,omitempty"` MergedBy *User `json:"merged_by,omitempty"` - MergeCommitSHA *string `json:"merge_commit_sha,omitempty"` Comments *int `json:"comments,omitempty"` Commits *int `json:"commits,omitempty"` Additions *int `json:"additions,omitempty"` diff --git a/github/pulls_test.go b/github/pulls_test.go index b34140f8c71..1c0e24bd6d6 100644 --- a/github/pulls_test.go +++ b/github/pulls_test.go @@ -1227,7 +1227,6 @@ func TestPullRequest_Marshal(t *testing.T) { CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, - MergeCommitSHA: Ptr("mcs"), Rebaseable: Ptr(false), Comments: Ptr(1), Commits: Ptr(1), @@ -1245,26 +1244,6 @@ func TestPullRequest_Marshal(t *testing.T) { ReviewCommentsURL: Ptr("rcurls"), ReviewCommentURL: Ptr("rcurl"), ReviewComments: Ptr(1), - Assignee: &User{ - Login: Ptr("l"), - ID: Ptr(int64(1)), - URL: Ptr("u"), - AvatarURL: Ptr("a"), - GravatarID: Ptr("g"), - Name: Ptr("n"), - Company: Ptr("c"), - Blog: Ptr("b"), - Location: Ptr("l"), - Email: Ptr("e"), - Hireable: Ptr(true), - Bio: Ptr("b"), - TwitterUsername: Ptr("t"), - PublicRepos: Ptr(1), - Followers: Ptr(1), - Following: Ptr(1), - CreatedAt: &Timestamp{referenceTime}, - SuspendedAt: &Timestamp{referenceTime}, - }, Assignees: []*User{ { Login: Ptr("l"), @@ -1436,7 +1415,6 @@ func TestPullRequest_Marshal(t *testing.T) { "suspended_at": ` + referenceTimeStr + `, "url": "u" }, - "merge_commit_sha": "mcs", "rebaseable": false, "comments": 1, "commits": 1, @@ -1454,26 +1432,6 @@ func TestPullRequest_Marshal(t *testing.T) { "review_comments_url": "rcurls", "review_comment_url": "rcurl", "review_comments": 1, - "assignee": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, "assignees": [ { "login": "l", diff --git a/github/repos.go b/github/repos.go index ac76f1f3f80..3a2060f0c53 100644 --- a/github/repos.go +++ b/github/repos.go @@ -36,7 +36,6 @@ type Repository struct { Homepage *string `json:"homepage,omitempty"` CodeOfConduct *CodeOfConduct `json:"code_of_conduct,omitempty"` DefaultBranch *string `json:"default_branch,omitempty"` - MasterBranch *string `json:"master_branch,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` PushedAt *Timestamp `json:"pushed_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"` @@ -71,7 +70,6 @@ type Repository struct { AllowForking *bool `json:"allow_forking,omitempty"` WebCommitSignoffRequired *bool `json:"web_commit_signoff_required,omitempty"` DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` - UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE" SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK" MergeCommitTitle *string `json:"merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "MERGE_MESSAGE" @@ -90,7 +88,6 @@ type Repository struct { HasWiki *bool `json:"has_wiki,omitempty"` HasPages *bool `json:"has_pages,omitempty"` HasProjects *bool `json:"has_projects,omitempty"` - HasDownloads *bool `json:"has_downloads,omitempty"` HasDiscussions *bool `json:"has_discussions,omitempty"` IsTemplate *bool `json:"is_template,omitempty"` LicenseTemplate *string `json:"license_template,omitempty"` @@ -520,7 +517,6 @@ type createRepoRequest struct { AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` AllowForking *bool `json:"allow_forking,omitempty"` DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` - UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` MergeCommitTitle *string `json:"merge_commit_title,omitempty"` @@ -580,7 +576,6 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo AllowAutoMerge: repo.AllowAutoMerge, AllowForking: repo.AllowForking, DeleteBranchOnMerge: repo.DeleteBranchOnMerge, - UseSquashPRTitleAsDefault: repo.UseSquashPRTitleAsDefault, SquashMergeCommitTitle: repo.SquashMergeCommitTitle, SquashMergeCommitMessage: repo.SquashMergeCommitMessage, MergeCommitTitle: repo.MergeCommitTitle, diff --git a/github/repos_attestations_test.go b/github/repos_attestations_test.go index cc522c3ce86..8b2584a320e 100644 --- a/github/repos_attestations_test.go +++ b/github/repos_attestations_test.go @@ -23,11 +23,11 @@ func TestRepositoriesService_ListAttestations(t *testing.T) { "attestations": [ { "repository_id": 1, - "bundle": {} + "bundle_url": "https://example.com/bundle/1" }, { "repository_id": 2, - "bundle": {} + "bundle_url": "https://example.com/bundle/2" } ] }`) @@ -42,11 +42,11 @@ func TestRepositoriesService_ListAttestations(t *testing.T) { Attestations: []*Attestation{ { RepositoryID: 1, - Bundle: []byte(`{}`), + BundleURL: Ptr("https://example.com/bundle/1"), }, { RepositoryID: 2, - Bundle: []byte(`{}`), + BundleURL: Ptr("https://example.com/bundle/2"), }, }, } diff --git a/github/search_test.go b/github/search_test.go index fc30fc75ebe..8b736da90a7 100644 --- a/github/search_test.go +++ b/github/search_test.go @@ -863,7 +863,6 @@ func TestIssuesSearchResult_Marshal(t *testing.T) { AuthorAssociation: Ptr("aa"), User: &User{ID: Ptr(int64(1))}, Labels: []*Label{{ID: Ptr(int64(1))}}, - Assignee: &User{ID: Ptr(int64(1))}, Comments: Ptr(1), ClosedAt: &Timestamp{referenceTime}, CreatedAt: &Timestamp{referenceTime}, @@ -907,9 +906,6 @@ func TestIssuesSearchResult_Marshal(t *testing.T) { "id": 1 } ], - "assignee": { - "id": 1 - }, "comments": 1, "closed_at": ` + referenceTimeStr + `, "created_at": ` + referenceTimeStr + `, diff --git a/github/security_advisories_test.go b/github/security_advisories_test.go index 5e4e187f979..3693e98fee3 100644 --- a/github/security_advisories_test.go +++ b/github/security_advisories_test.go @@ -122,7 +122,6 @@ func TestSecurityAdvisoriesService_CreateTemporaryPrivateFork(t *testing.T) { "has_wiki": false, "has_pages": false, "has_projects": false, - "has_downloads": false, "has_discussions": false, "is_template": false, "url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx", @@ -231,7 +230,6 @@ func TestSecurityAdvisoriesService_CreateTemporaryPrivateFork(t *testing.T) { HasWiki: Ptr(false), HasPages: Ptr(false), HasProjects: Ptr(false), - HasDownloads: Ptr(false), HasDiscussions: Ptr(false), IsTemplate: Ptr(false), URL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx"), @@ -358,7 +356,6 @@ func TestSecurityAdvisoriesService_CreateTemporaryPrivateFork_deferred(t *testin "has_wiki": false, "has_pages": false, "has_projects": false, - "has_downloads": false, "has_discussions": false, "is_template": false, "url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx", @@ -467,7 +464,6 @@ func TestSecurityAdvisoriesService_CreateTemporaryPrivateFork_deferred(t *testin HasWiki: Ptr(false), HasPages: Ptr(false), HasProjects: Ptr(false), - HasDownloads: Ptr(false), HasDiscussions: Ptr(false), IsTemplate: Ptr(false), URL: Ptr("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx"), diff --git a/github/teams.go b/github/teams.go index cf9a616d3fd..4265612ae6d 100644 --- a/github/teams.go +++ b/github/teams.go @@ -171,13 +171,6 @@ type NewTeam struct { // NotificationSetting can be one of: "notifications_enabled", "notifications_disabled". NotificationSetting *string `json:"notification_setting,omitempty"` - // Deprecated: Permission is deprecated when creating or editing a team in an org - // using the new GitHub permission model. It no longer identifies the - // permission a team has on its repos, but only specifies the default - // permission a repo is initially added with. Avoid confusion by - // specifying a permission value when calling AddTeamRepo. - Permission *string `json:"permission,omitempty"` - // Privacy identifies the level of privacy this team should have. // Possible values are: // secret - only visible to organization owners and members of this team diff --git a/github/teams_test.go b/github/teams_test.go index 2efc1cd4f9a..46d1a117085 100644 --- a/github/teams_test.go +++ b/github/teams_test.go @@ -1588,7 +1588,6 @@ func TestNewTeam_Marshal(t *testing.T) { RepoNames: []string{"repo1", "repo2"}, NotificationSetting: Ptr("notifications_enabled"), ParentTeamID: Ptr(int64(1)), - Permission: Ptr("perm"), Privacy: Ptr("p"), LDAPDN: Ptr("l"), } @@ -1600,7 +1599,6 @@ func TestNewTeam_Marshal(t *testing.T) { "repo_names": ["repo1", "repo2"], "parent_team_id": 1, "notification_setting": "notifications_enabled", - "permission": "perm", "privacy": "p", "ldap_dn": "l" }` diff --git a/github/users_attestations_test.go b/github/users_attestations_test.go index 347af245f8a..bae4483701d 100644 --- a/github/users_attestations_test.go +++ b/github/users_attestations_test.go @@ -23,11 +23,11 @@ func TestUsersService_ListAttestations(t *testing.T) { "attestations": [ { "repository_id": 1, - "bundle": {} + "bundle_url": "https://example.com/bundle/1" }, { "repository_id": 2, - "bundle": {} + "bundle_url": "https://example.com/bundle/2" } ] }`) @@ -42,11 +42,11 @@ func TestUsersService_ListAttestations(t *testing.T) { Attestations: []*Attestation{ { RepositoryID: 1, - Bundle: []byte(`{}`), + BundleURL: Ptr("https://example.com/bundle/1"), }, { RepositoryID: 2, - Bundle: []byte(`{}`), + BundleURL: Ptr("https://example.com/bundle/2"), }, }, } From 499148fd206fb0de9ce7cf88855e1fca3f2326f2 Mon Sep 17 00:00:00 2001 From: Max Farrell Date: Thu, 12 Mar 2026 20:31:01 -0500 Subject: [PATCH 3/3] fix: Resolve lint errors from API version 2026-03-10 migration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename CVSS struct fields to use all-caps initialism (CvssV3 → CVSSV3, CvssV4 → CVSSV4, CvssSeverities → CVSSSeverities), update the verifyartifact example to fetch bundles via BundleURL instead of the removed Bundle field, and fix gci formatting. Co-Authored-By: Claude Opus 4.6 --- example/verifyartifact/main.go | 19 +++- github/dependabot_alerts.go | 6 +- github/event_types.go | 2 +- github/github-accessors.go | 24 ++--- github/github-accessors_test.go | 24 ++--- github/issues.go | 8 +- github/repos.go | 184 ++++++++++++++++---------------- 7 files changed, 139 insertions(+), 128 deletions(-) diff --git a/example/verifyartifact/main.go b/example/verifyartifact/main.go index 383229383e8..14b031cc5a6 100644 --- a/example/verifyartifact/main.go +++ b/example/verifyartifact/main.go @@ -15,7 +15,9 @@ import ( "encoding/json" "flag" "fmt" + "io" "log" + "net/http" "os" "github.com/google/go-github/v84/github" @@ -102,16 +104,25 @@ func main() { log.Fatal(err) } - var b *bundle.Bundle for _, attestation := range attestations.Attestations { - if err := json.Unmarshal(attestation.Bundle, &b); err != nil { + resp, err := http.Get(attestation.GetBundleURL()) + if err != nil { log.Fatal(err) } - - err := runVerification(sev, pb, b) + body, err := io.ReadAll(resp.Body) + resp.Body.Close() if err != nil { log.Fatal(err) } + + var b *bundle.Bundle + if err := json.Unmarshal(body, &b); err != nil { + log.Fatal(err) + } + + if err := runVerification(sev, pb, b); err != nil { + log.Fatal(err) + } } } diff --git a/github/dependabot_alerts.go b/github/dependabot_alerts.go index f343ec14b89..f87038fa302 100644 --- a/github/dependabot_alerts.go +++ b/github/dependabot_alerts.go @@ -25,8 +25,8 @@ type AdvisoryCVSS struct { // AdvisoryCvssSeverities contains CVSS v3 and v4 severity information for a security advisory. type AdvisoryCvssSeverities struct { - CvssV3 *AdvisoryCVSS `json:"cvss_v3,omitempty"` - CvssV4 *AdvisoryCVSS `json:"cvss_v4,omitempty"` + CVSSV3 *AdvisoryCVSS `json:"cvss_v3,omitempty"` + CVSSV4 *AdvisoryCVSS `json:"cvss_v4,omitempty"` } // AdvisoryCWEs represent the advisory pertaining to Common Weakness Enumeration. @@ -53,7 +53,7 @@ type DependabotSecurityAdvisory struct { Vulnerabilities []*AdvisoryVulnerability `json:"vulnerabilities,omitempty"` Severity *string `json:"severity,omitempty"` CVSS *AdvisoryCVSS `json:"cvss,omitempty"` - CvssSeverities *AdvisoryCvssSeverities `json:"cvss_severities,omitempty"` + CVSSSeverities *AdvisoryCvssSeverities `json:"cvss_severities,omitempty"` CWEs []*AdvisoryCWEs `json:"cwes,omitempty"` EPSS *AdvisoryEPSS `json:"epss,omitempty"` Identifiers []*AdvisoryIdentifier `json:"identifiers,omitempty"` diff --git a/github/event_types.go b/github/event_types.go index c96e12600af..5b277618795 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1884,7 +1884,7 @@ type WorkflowRunEvent struct { // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory type SecurityAdvisory struct { CVSS *AdvisoryCVSS `json:"cvss,omitempty"` - CvssSeverities *AdvisoryCvssSeverities `json:"cvss_severities,omitempty"` + CVSSSeverities *AdvisoryCvssSeverities `json:"cvss_severities,omitempty"` CWEs []*AdvisoryCWEs `json:"cwes,omitempty"` GHSAID *string `json:"ghsa_id,omitempty"` Summary *string `json:"summary,omitempty"` diff --git a/github/github-accessors.go b/github/github-accessors.go index 72627908613..328d053fcc3 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -502,20 +502,20 @@ func (a *AdvisoryCVSS) GetVectorString() string { return *a.VectorString } -// GetCvssV3 returns the CvssV3 field. -func (a *AdvisoryCvssSeverities) GetCvssV3() *AdvisoryCVSS { +// GetCVSSV3 returns the CVSSV3 field. +func (a *AdvisoryCvssSeverities) GetCVSSV3() *AdvisoryCVSS { if a == nil { return nil } - return a.CvssV3 + return a.CVSSV3 } -// GetCvssV4 returns the CvssV4 field. -func (a *AdvisoryCvssSeverities) GetCvssV4() *AdvisoryCVSS { +// GetCVSSV4 returns the CVSSV4 field. +func (a *AdvisoryCvssSeverities) GetCVSSV4() *AdvisoryCVSS { if a == nil { return nil } - return a.CvssV4 + return a.CVSSV4 } // GetCWEID returns the CWEID field if it's non-nil, zero value otherwise. @@ -8038,12 +8038,12 @@ func (d *DependabotSecurityAdvisory) GetCVSS() *AdvisoryCVSS { return d.CVSS } -// GetCvssSeverities returns the CvssSeverities field. -func (d *DependabotSecurityAdvisory) GetCvssSeverities() *AdvisoryCvssSeverities { +// GetCVSSSeverities returns the CVSSSeverities field. +func (d *DependabotSecurityAdvisory) GetCVSSSeverities() *AdvisoryCvssSeverities { if d == nil { return nil } - return d.CvssSeverities + return d.CVSSSeverities } // GetDescription returns the Description field if it's non-nil, zero value otherwise. @@ -28262,12 +28262,12 @@ func (s *SecurityAdvisory) GetCVSS() *AdvisoryCVSS { return s.CVSS } -// GetCvssSeverities returns the CvssSeverities field. -func (s *SecurityAdvisory) GetCvssSeverities() *AdvisoryCvssSeverities { +// GetCVSSSeverities returns the CVSSSeverities field. +func (s *SecurityAdvisory) GetCVSSSeverities() *AdvisoryCvssSeverities { if s == nil { return nil } - return s.CvssSeverities + return s.CVSSSeverities } // GetDescription returns the Description field if it's non-nil, zero value otherwise. diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index c4875476670..2ca76eb7649 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -641,20 +641,20 @@ func TestAdvisoryCVSS_GetVectorString(tt *testing.T) { a.GetVectorString() } -func TestAdvisoryCvssSeverities_GetCvssV3(tt *testing.T) { +func TestAdvisoryCvssSeverities_GetCVSSV3(tt *testing.T) { tt.Parallel() a := &AdvisoryCvssSeverities{} - a.GetCvssV3() + a.GetCVSSV3() a = nil - a.GetCvssV3() + a.GetCVSSV3() } -func TestAdvisoryCvssSeverities_GetCvssV4(tt *testing.T) { +func TestAdvisoryCvssSeverities_GetCVSSV4(tt *testing.T) { tt.Parallel() a := &AdvisoryCvssSeverities{} - a.GetCvssV4() + a.GetCVSSV4() a = nil - a.GetCvssV4() + a.GetCVSSV4() } func TestAdvisoryCWEs_GetCWEID(tt *testing.T) { @@ -10484,12 +10484,12 @@ func TestDependabotSecurityAdvisory_GetCVSS(tt *testing.T) { d.GetCVSS() } -func TestDependabotSecurityAdvisory_GetCvssSeverities(tt *testing.T) { +func TestDependabotSecurityAdvisory_GetCVSSSeverities(tt *testing.T) { tt.Parallel() d := &DependabotSecurityAdvisory{} - d.GetCvssSeverities() + d.GetCVSSSeverities() d = nil - d.GetCvssSeverities() + d.GetCVSSSeverities() } func TestDependabotSecurityAdvisory_GetDescription(tt *testing.T) { @@ -36489,12 +36489,12 @@ func TestSecurityAdvisory_GetCVSS(tt *testing.T) { s.GetCVSS() } -func TestSecurityAdvisory_GetCvssSeverities(tt *testing.T) { +func TestSecurityAdvisory_GetCVSSSeverities(tt *testing.T) { tt.Parallel() s := &SecurityAdvisory{} - s.GetCvssSeverities() + s.GetCVSSSeverities() s = nil - s.GetCvssSeverities() + s.GetCVSSSeverities() } func TestSecurityAdvisory_GetDescription(tt *testing.T) { diff --git a/github/issues.go b/github/issues.go index fb258bef2b7..96126eecaac 100644 --- a/github/issues.go +++ b/github/issues.go @@ -87,10 +87,10 @@ func (i Issue) IsPullRequest() bool { // It is separate from Issue above because otherwise Labels // and Assignees fail to serialize to the correct JSON. type IssueRequest struct { - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - Labels *[]string `json:"labels,omitempty"` - State *string `json:"state,omitempty"` + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + Labels *[]string `json:"labels,omitempty"` + State *string `json:"state,omitempty"` // StateReason can be 'completed' or 'not_planned'. StateReason *string `json:"state_reason,omitempty"` Milestone *int `json:"milestone,omitempty"` diff --git a/github/repos.go b/github/repos.go index 3a2060f0c53..587764eff81 100644 --- a/github/repos.go +++ b/github/repos.go @@ -27,57 +27,57 @@ type RepositoriesService service // Repository represents a GitHub repository. type Repository struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Owner *User `json:"owner,omitempty"` - Name *string `json:"name,omitempty"` - FullName *string `json:"full_name,omitempty"` - Description *string `json:"description,omitempty"` - Homepage *string `json:"homepage,omitempty"` - CodeOfConduct *CodeOfConduct `json:"code_of_conduct,omitempty"` - DefaultBranch *string `json:"default_branch,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - PushedAt *Timestamp `json:"pushed_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CloneURL *string `json:"clone_url,omitempty"` - GitURL *string `json:"git_url,omitempty"` - MirrorURL *string `json:"mirror_url,omitempty"` - SSHURL *string `json:"ssh_url,omitempty"` - SVNURL *string `json:"svn_url,omitempty"` - Language *string `json:"language,omitempty"` - Fork *bool `json:"fork,omitempty"` - ForksCount *int `json:"forks_count,omitempty"` - NetworkCount *int `json:"network_count,omitempty"` - OpenIssuesCount *int `json:"open_issues_count,omitempty"` - OpenIssues *int `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount. For backward compatibility OpenIssues is still populated. - StargazersCount *int `json:"stargazers_count,omitempty"` - SubscribersCount *int `json:"subscribers_count,omitempty"` - WatchersCount *int `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility WatchersCount is still populated. - Watchers *int `json:"watchers,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility Watchers is still populated. - Size *int `json:"size,omitempty"` - AutoInit *bool `json:"auto_init,omitempty"` - Parent *Repository `json:"parent,omitempty"` - Source *Repository `json:"source,omitempty"` - TemplateRepository *Repository `json:"template_repository,omitempty"` - Organization *Organization `json:"organization,omitempty"` - Permissions *RepositoryPermissions `json:"permissions,omitempty"` - AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` - AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` - AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` - AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` - AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` - AllowForking *bool `json:"allow_forking,omitempty"` - WebCommitSignoffRequired *bool `json:"web_commit_signoff_required,omitempty"` - DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` - SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE" - SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK" - MergeCommitTitle *string `json:"merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "MERGE_MESSAGE" - MergeCommitMessage *string `json:"merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "PR_TITLE", "BLANK" - Topics []string `json:"topics,omitempty"` - CustomProperties map[string]any `json:"custom_properties,omitempty"` - Archived *bool `json:"archived,omitempty"` - Disabled *bool `json:"disabled,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Owner *User `json:"owner,omitempty"` + Name *string `json:"name,omitempty"` + FullName *string `json:"full_name,omitempty"` + Description *string `json:"description,omitempty"` + Homepage *string `json:"homepage,omitempty"` + CodeOfConduct *CodeOfConduct `json:"code_of_conduct,omitempty"` + DefaultBranch *string `json:"default_branch,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + PushedAt *Timestamp `json:"pushed_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + CloneURL *string `json:"clone_url,omitempty"` + GitURL *string `json:"git_url,omitempty"` + MirrorURL *string `json:"mirror_url,omitempty"` + SSHURL *string `json:"ssh_url,omitempty"` + SVNURL *string `json:"svn_url,omitempty"` + Language *string `json:"language,omitempty"` + Fork *bool `json:"fork,omitempty"` + ForksCount *int `json:"forks_count,omitempty"` + NetworkCount *int `json:"network_count,omitempty"` + OpenIssuesCount *int `json:"open_issues_count,omitempty"` + OpenIssues *int `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount. For backward compatibility OpenIssues is still populated. + StargazersCount *int `json:"stargazers_count,omitempty"` + SubscribersCount *int `json:"subscribers_count,omitempty"` + WatchersCount *int `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility WatchersCount is still populated. + Watchers *int `json:"watchers,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility Watchers is still populated. + Size *int `json:"size,omitempty"` + AutoInit *bool `json:"auto_init,omitempty"` + Parent *Repository `json:"parent,omitempty"` + Source *Repository `json:"source,omitempty"` + TemplateRepository *Repository `json:"template_repository,omitempty"` + Organization *Organization `json:"organization,omitempty"` + Permissions *RepositoryPermissions `json:"permissions,omitempty"` + AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` + AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` + AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` + AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` + AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` + AllowForking *bool `json:"allow_forking,omitempty"` + WebCommitSignoffRequired *bool `json:"web_commit_signoff_required,omitempty"` + DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` + SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE" + SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK" + MergeCommitTitle *string `json:"merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "MERGE_MESSAGE" + MergeCommitMessage *string `json:"merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "PR_TITLE", "BLANK" + Topics []string `json:"topics,omitempty"` + CustomProperties map[string]any `json:"custom_properties,omitempty"` + Archived *bool `json:"archived,omitempty"` + Disabled *bool `json:"disabled,omitempty"` // Only provided when using RepositoriesService.Get while in preview License *License `json:"license,omitempty"` @@ -507,21 +507,21 @@ type createRepoRequest struct { // Creating an organization repository. Required for non-owners. TeamID *int64 `json:"team_id,omitempty"` - AutoInit *bool `json:"auto_init,omitempty"` - GitignoreTemplate *string `json:"gitignore_template,omitempty"` - LicenseTemplate *string `json:"license_template,omitempty"` - AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` - AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` - AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` - AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` - AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` - AllowForking *bool `json:"allow_forking,omitempty"` - DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` - SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` - SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` - MergeCommitTitle *string `json:"merge_commit_title,omitempty"` - MergeCommitMessage *string `json:"merge_commit_message,omitempty"` - CustomProperties map[string]any `json:"custom_properties,omitempty"` + AutoInit *bool `json:"auto_init,omitempty"` + GitignoreTemplate *string `json:"gitignore_template,omitempty"` + LicenseTemplate *string `json:"license_template,omitempty"` + AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` + AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` + AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` + AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` + AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` + AllowForking *bool `json:"allow_forking,omitempty"` + DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` + SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` + SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` + MergeCommitTitle *string `json:"merge_commit_title,omitempty"` + MergeCommitMessage *string `json:"merge_commit_message,omitempty"` + CustomProperties map[string]any `json:"custom_properties,omitempty"` } // Create a new repository. If an organization is specified, the new @@ -555,32 +555,32 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo } repoReq := &createRepoRequest{ - Name: repo.Name, - Description: repo.Description, - Homepage: repo.Homepage, - Private: repo.Private, - Visibility: repo.Visibility, - HasIssues: repo.HasIssues, - HasProjects: repo.HasProjects, - HasWiki: repo.HasWiki, - HasDiscussions: repo.HasDiscussions, - IsTemplate: repo.IsTemplate, - TeamID: repo.TeamID, - AutoInit: repo.AutoInit, - GitignoreTemplate: repo.GitignoreTemplate, - LicenseTemplate: repo.LicenseTemplate, - AllowSquashMerge: repo.AllowSquashMerge, - AllowMergeCommit: repo.AllowMergeCommit, - AllowRebaseMerge: repo.AllowRebaseMerge, - AllowUpdateBranch: repo.AllowUpdateBranch, - AllowAutoMerge: repo.AllowAutoMerge, - AllowForking: repo.AllowForking, - DeleteBranchOnMerge: repo.DeleteBranchOnMerge, - SquashMergeCommitTitle: repo.SquashMergeCommitTitle, - SquashMergeCommitMessage: repo.SquashMergeCommitMessage, - MergeCommitTitle: repo.MergeCommitTitle, - MergeCommitMessage: repo.MergeCommitMessage, - CustomProperties: repo.CustomProperties, + Name: repo.Name, + Description: repo.Description, + Homepage: repo.Homepage, + Private: repo.Private, + Visibility: repo.Visibility, + HasIssues: repo.HasIssues, + HasProjects: repo.HasProjects, + HasWiki: repo.HasWiki, + HasDiscussions: repo.HasDiscussions, + IsTemplate: repo.IsTemplate, + TeamID: repo.TeamID, + AutoInit: repo.AutoInit, + GitignoreTemplate: repo.GitignoreTemplate, + LicenseTemplate: repo.LicenseTemplate, + AllowSquashMerge: repo.AllowSquashMerge, + AllowMergeCommit: repo.AllowMergeCommit, + AllowRebaseMerge: repo.AllowRebaseMerge, + AllowUpdateBranch: repo.AllowUpdateBranch, + AllowAutoMerge: repo.AllowAutoMerge, + AllowForking: repo.AllowForking, + DeleteBranchOnMerge: repo.DeleteBranchOnMerge, + SquashMergeCommitTitle: repo.SquashMergeCommitTitle, + SquashMergeCommitMessage: repo.SquashMergeCommitMessage, + MergeCommitTitle: repo.MergeCommitTitle, + MergeCommitMessage: repo.MergeCommitMessage, + CustomProperties: repo.CustomProperties, } req, err := s.client.NewRequest("POST", u, repoReq)