diff --git a/github/attestations.go b/github/attestations.go index 618d5d73f6c..d2212c9caa3 100644 --- a/github/attestations.go +++ b/github/attestations.go @@ -17,8 +17,12 @@ type Attestation struct { // 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"` + Bundle json.RawMessage `json:"bundle,omitempty"` + // The download URL for the attestation's Sigstore Bundle. + BundleURL *string `json:"bundle_url,omitempty"` + // The entity that initiated the attestation. + Initiator *string `json:"initiator,omitempty"` + RepositoryID int64 `json:"repository_id"` } // AttestationsResponse represents a collection of artifact attestations. diff --git a/github/github-accessors.go b/github/github-accessors.go index 952d3d8fea0..ea207847a27 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -3046,6 +3046,22 @@ func (a *Attestation) GetBundle() json.RawMessage { return a.Bundle } +// 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 +} + +// GetInitiator returns the Initiator field if it's non-nil, zero value otherwise. +func (a *Attestation) GetInitiator() string { + if a == nil || a.Initiator == nil { + return "" + } + return *a.Initiator +} + // GetRepositoryID returns the RepositoryID field. func (a *Attestation) GetRepositoryID() int64 { if a == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 7e9ad6671c9..a797d3f6e26 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -3809,6 +3809,28 @@ func TestAttestation_GetBundle(tt *testing.T) { a.GetBundle() } +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 TestAttestation_GetInitiator(tt *testing.T) { + tt.Parallel() + var zeroValue string + a := &Attestation{Initiator: &zeroValue} + a.GetInitiator() + a = &Attestation{} + a.GetInitiator() + a = nil + a.GetInitiator() +} + func TestAttestation_GetRepositoryID(tt *testing.T) { tt.Parallel() a := &Attestation{} diff --git a/github/orgs_attestations_test.go b/github/orgs_attestations_test.go index a0ed59c9f0e..fe6107b9725 100644 --- a/github/orgs_attestations_test.go +++ b/github/orgs_attestations_test.go @@ -23,7 +23,8 @@ func TestOrganizationsService_ListAttestations(t *testing.T) { "attestations": [ { "repository_id": 1, - "bundle": {} + "bundle_url": "https://example.com/bundle.json", + "initiator": "octocat" }, { "repository_id": 2, @@ -42,7 +43,8 @@ func TestOrganizationsService_ListAttestations(t *testing.T) { Attestations: []*Attestation{ { RepositoryID: 1, - Bundle: []byte(`{}`), + BundleURL: new("https://example.com/bundle.json"), + Initiator: new("octocat"), }, { RepositoryID: 2, diff --git a/github/repos_attestations_test.go b/github/repos_attestations_test.go index cc522c3ce86..48e10252670 100644 --- a/github/repos_attestations_test.go +++ b/github/repos_attestations_test.go @@ -23,7 +23,8 @@ func TestRepositoriesService_ListAttestations(t *testing.T) { "attestations": [ { "repository_id": 1, - "bundle": {} + "bundle_url": "https://example.com/bundle.json", + "initiator": "octocat" }, { "repository_id": 2, @@ -42,7 +43,8 @@ func TestRepositoriesService_ListAttestations(t *testing.T) { Attestations: []*Attestation{ { RepositoryID: 1, - Bundle: []byte(`{}`), + BundleURL: new("https://example.com/bundle.json"), + Initiator: new("octocat"), }, { RepositoryID: 2, diff --git a/github/users_attestations_test.go b/github/users_attestations_test.go index 347af245f8a..3b43d8bca5b 100644 --- a/github/users_attestations_test.go +++ b/github/users_attestations_test.go @@ -23,7 +23,8 @@ func TestUsersService_ListAttestations(t *testing.T) { "attestations": [ { "repository_id": 1, - "bundle": {} + "bundle_url": "https://example.com/bundle.json", + "initiator": "octocat" }, { "repository_id": 2, @@ -42,7 +43,8 @@ func TestUsersService_ListAttestations(t *testing.T) { Attestations: []*Attestation{ { RepositoryID: 1, - Bundle: []byte(`{}`), + BundleURL: new("https://example.com/bundle.json"), + Initiator: new("octocat"), }, { RepositoryID: 2,