...
1
2
3
4
5
6 package github
7
8 import (
9 "context"
10 "fmt"
11 )
12
13
14
15
16 type ActionsAllowed struct {
17 GithubOwnedAllowed *bool `json:"github_owned_allowed,omitempty"`
18 VerifiedAllowed *bool `json:"verified_allowed,omitempty"`
19 PatternsAllowed []string `json:"patterns_allowed,omitempty"`
20 }
21
22 func (a ActionsAllowed) String() string {
23 return Stringify(a)
24 }
25
26
27
28
29 func (s *OrganizationsService) GetActionsAllowed(ctx context.Context, org string) (*ActionsAllowed, *Response, error) {
30 u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org)
31
32 req, err := s.client.NewRequest("GET", u, nil)
33 if err != nil {
34 return nil, nil, err
35 }
36
37 actionsAllowed := new(ActionsAllowed)
38 resp, err := s.client.Do(ctx, req, actionsAllowed)
39 if err != nil {
40 return nil, resp, err
41 }
42
43 return actionsAllowed, resp, nil
44 }
45
46
47
48
49 func (s *OrganizationsService) EditActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) {
50 u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org)
51 req, err := s.client.NewRequest("PUT", u, actionsAllowed)
52 if err != nil {
53 return nil, nil, err
54 }
55
56 p := new(ActionsAllowed)
57 resp, err := s.client.Do(ctx, req, p)
58 if err != nil {
59 return nil, resp, err
60 }
61
62 return p, resp, nil
63 }
64
View as plain text