From d5618ce38b8f7f23608a7cd81a169f2759d09ad3 Mon Sep 17 00:00:00 2001 From: Frank2006x Date: Sun, 18 Oct 2026 17:57:46 +0000 Subject: [PATCH 1/2] feat: Add BundleURL to Attestation --- github/attestations.go | 6 ++++-- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 11 +++++++++++ github/orgs_attestations_test.go | 4 ++-- github/repos_attestations_test.go | 4 ++-- github/users_attestations_test.go | 4 ++-- 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/github/attestations.go b/github/attestations.go index 618d5d73f6c..61994fec366 100644 --- a/github/attestations.go +++ b/github/attestations.go @@ -17,8 +17,10 @@ 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"` + 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..5fdfc607848 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -3046,6 +3046,14 @@ 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 +} + // 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..c7986deb3d5 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -3809,6 +3809,17 @@ 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_GetRepositoryID(tt *testing.T) { tt.Parallel() a := &Attestation{} diff --git a/github/orgs_attestations_test.go b/github/orgs_attestations_test.go index a0ed59c9f0e..489f8487a43 100644 --- a/github/orgs_attestations_test.go +++ b/github/orgs_attestations_test.go @@ -23,7 +23,7 @@ func TestOrganizationsService_ListAttestations(t *testing.T) { "attestations": [ { "repository_id": 1, - "bundle": {} + "bundle_url": "https://example.com/bundle.json" }, { "repository_id": 2, @@ -42,7 +42,7 @@ func TestOrganizationsService_ListAttestations(t *testing.T) { Attestations: []*Attestation{ { RepositoryID: 1, - Bundle: []byte(`{}`), + BundleURL: new("https://example.com/bundle.json"), }, { RepositoryID: 2, diff --git a/github/repos_attestations_test.go b/github/repos_attestations_test.go index cc522c3ce86..9ae25a46a99 100644 --- a/github/repos_attestations_test.go +++ b/github/repos_attestations_test.go @@ -23,7 +23,7 @@ func TestRepositoriesService_ListAttestations(t *testing.T) { "attestations": [ { "repository_id": 1, - "bundle": {} + "bundle_url": "https://example.com/bundle.json" }, { "repository_id": 2, @@ -42,7 +42,7 @@ func TestRepositoriesService_ListAttestations(t *testing.T) { Attestations: []*Attestation{ { RepositoryID: 1, - Bundle: []byte(`{}`), + BundleURL: new("https://example.com/bundle.json"), }, { RepositoryID: 2, diff --git a/github/users_attestations_test.go b/github/users_attestations_test.go index 347af245f8a..18466211a2f 100644 --- a/github/users_attestations_test.go +++ b/github/users_attestations_test.go @@ -23,7 +23,7 @@ func TestUsersService_ListAttestations(t *testing.T) { "attestations": [ { "repository_id": 1, - "bundle": {} + "bundle_url": "https://example.com/bundle.json" }, { "repository_id": 2, @@ -42,7 +42,7 @@ func TestUsersService_ListAttestations(t *testing.T) { Attestations: []*Attestation{ { RepositoryID: 1, - Bundle: []byte(`{}`), + BundleURL: new("https://example.com/bundle.json"), }, { RepositoryID: 2, From f04d5ac8e49ca3f34a50da5a079b33d324f8f62b Mon Sep 17 00:00:00 2001 From: Frank2006x Date: Mon, 19 Oct 2026 17:50:20 +0000 Subject: [PATCH 2/2] feat : added Initiator to Attestation struct --- github/attestations.go | 4 +++- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 11 +++++++++++ github/orgs_attestations_test.go | 4 +++- github/repos_attestations_test.go | 4 +++- github/users_attestations_test.go | 4 +++- 6 files changed, 31 insertions(+), 4 deletions(-) diff --git a/github/attestations.go b/github/attestations.go index 61994fec366..d2212c9caa3 100644 --- a/github/attestations.go +++ b/github/attestations.go @@ -19,7 +19,9 @@ type Attestation struct { // https://github.com/sigstore/protobuf-specs/blob/main/protos/sigstore_bundle.proto Bundle json.RawMessage `json:"bundle,omitempty"` // The download URL for the attestation's Sigstore Bundle. - BundleURL *string `json:"bundle_url,omitempty"` + BundleURL *string `json:"bundle_url,omitempty"` + // The entity that initiated the attestation. + Initiator *string `json:"initiator,omitempty"` RepositoryID int64 `json:"repository_id"` } diff --git a/github/github-accessors.go b/github/github-accessors.go index 5fdfc607848..ea207847a27 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -3054,6 +3054,14 @@ func (a *Attestation) GetBundleURL() string { 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 c7986deb3d5..a797d3f6e26 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -3820,6 +3820,17 @@ func TestAttestation_GetBundleURL(tt *testing.T) { 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 489f8487a43..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_url": "https://example.com/bundle.json" + "bundle_url": "https://example.com/bundle.json", + "initiator": "octocat" }, { "repository_id": 2, @@ -43,6 +44,7 @@ func TestOrganizationsService_ListAttestations(t *testing.T) { { RepositoryID: 1, 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 9ae25a46a99..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_url": "https://example.com/bundle.json" + "bundle_url": "https://example.com/bundle.json", + "initiator": "octocat" }, { "repository_id": 2, @@ -43,6 +44,7 @@ func TestRepositoriesService_ListAttestations(t *testing.T) { { RepositoryID: 1, 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 18466211a2f..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_url": "https://example.com/bundle.json" + "bundle_url": "https://example.com/bundle.json", + "initiator": "octocat" }, { "repository_id": 2, @@ -43,6 +44,7 @@ func TestUsersService_ListAttestations(t *testing.T) { { RepositoryID: 1, BundleURL: new("https://example.com/bundle.json"), + Initiator: new("octocat"), }, { RepositoryID: 2,