...
1
2
3
4
5
6 package github
7
8 import (
9 "context"
10 "fmt"
11 )
12
13
14
15
16 func (s *RepositoriesService) GetActionsAllowed(ctx context.Context, org, repo string) (*ActionsAllowed, *Response, error) {
17 u := fmt.Sprintf("repos/%v/%v/actions/permissions/selected-actions", org, repo)
18 req, err := s.client.NewRequest("GET", u, nil)
19 if err != nil {
20 return nil, nil, err
21 }
22
23 actionsAllowed := new(ActionsAllowed)
24 resp, err := s.client.Do(ctx, req, actionsAllowed)
25 if err != nil {
26 return nil, resp, err
27 }
28
29 return actionsAllowed, resp, nil
30 }
31
32
33
34
35 func (s *RepositoriesService) EditActionsAllowed(ctx context.Context, org, repo string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) {
36 u := fmt.Sprintf("repos/%v/%v/actions/permissions/selected-actions", org, repo)
37 req, err := s.client.NewRequest("PUT", u, actionsAllowed)
38 if err != nil {
39 return nil, nil, err
40 }
41
42 p := new(ActionsAllowed)
43 resp, err := s.client.Do(ctx, req, p)
44 if err != nil {
45 return nil, resp, err
46 }
47
48 return p, resp, nil
49 }
50
View as plain text