-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathorgs_attestations.go
More file actions
40 lines (33 loc) · 1.07 KB
/
orgs_attestations.go
File metadata and controls
40 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2024 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package github
import (
"context"
"fmt"
)
// ListAttestations returns a collection of artifact attestations
// with a given subject digest that are associated with repositories
// owned by an organization.
//
// GitHub API docs: https://docs.github.com/rest/orgs/attestations#list-attestations
//
//meta:operation GET /orgs/{org}/attestations/{subject_digest}
func (s *OrganizationsService) ListAttestations(ctx context.Context, org, subjectDigest string, opts *ListOptions) (*AttestationsResponse, *Response, error) {
u := fmt.Sprintf("orgs/%v/attestations/%v", org, subjectDigest)
u, err := addOptions(u, opts)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
var attestations *AttestationsResponse
resp, err := s.client.Do(ctx, req, &attestations)
if err != nil {
return nil, resp, err
}
return attestations, resp, nil
}