github.com/google/go-github/v74@v74.0.0/github/repos_attestations.go (about) 1 // Copyright 2024 The go-github AUTHORS. All rights reserved. 2 // 3 // Use of this source code is governed by a BSD-style 4 // license that can be found in the LICENSE file. 5 6 package github 7 8 import ( 9 "context" 10 "fmt" 11 ) 12 13 // ListAttestations returns a collection of artifact attestations 14 // with a given subject digest that are associated with a repository. 15 // 16 // GitHub API docs: https://docs.github.com/rest/repos/repos#list-attestations 17 // 18 //meta:operation GET /repos/{owner}/{repo}/attestations/{subject_digest} 19 func (s *RepositoriesService) ListAttestations(ctx context.Context, owner, repo, subjectDigest string, opts *ListOptions) (*AttestationsResponse, *Response, error) { 20 var u = fmt.Sprintf("repos/%v/%v/attestations/%v", owner, repo, subjectDigest) 21 22 u, err := addOptions(u, opts) 23 if err != nil { 24 return nil, nil, err 25 } 26 27 req, err := s.client.NewRequest("GET", u, nil) 28 if err != nil { 29 return nil, nil, err 30 } 31 32 var attestations *AttestationsResponse 33 resp, err := s.client.Do(ctx, req, &attestations) 34 if err != nil { 35 return nil, resp, err 36 } 37 38 return attestations, resp, nil 39 }