...
1
2
3
4
5
6 package github
7
8 import (
9 "context"
10 "fmt"
11 )
12
13
14
15
16 type ActionsPermissionsRepository struct {
17 Enabled *bool `json:"enabled,omitempty"`
18 AllowedActions *string `json:"allowed_actions,omitempty"`
19 SelectedActionsURL *string `json:"selected_actions_url,omitempty"`
20 }
21
22 func (a ActionsPermissionsRepository) String() string {
23 return Stringify(a)
24 }
25
26
27
28
29 func (s *RepositoriesService) GetActionsPermissions(ctx context.Context, owner, repo string) (*ActionsPermissionsRepository, *Response, error) {
30 u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo)
31 req, err := s.client.NewRequest("GET", u, nil)
32 if err != nil {
33 return nil, nil, err
34 }
35
36 permissions := new(ActionsPermissionsRepository)
37 resp, err := s.client.Do(ctx, req, permissions)
38 if err != nil {
39 return nil, resp, err
40 }
41
42 return permissions, resp, nil
43 }
44
45
46
47
48 func (s *RepositoriesService) EditActionsPermissions(ctx context.Context, owner, repo string, actionsPermissionsRepository ActionsPermissionsRepository) (*ActionsPermissionsRepository, *Response, error) {
49 u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo)
50 req, err := s.client.NewRequest("PUT", u, actionsPermissionsRepository)
51 if err != nil {
52 return nil, nil, err
53 }
54
55 permissions := new(ActionsPermissionsRepository)
56 resp, err := s.client.Do(ctx, req, permissions)
57 if err != nil {
58 return nil, resp, err
59 }
60
61 return permissions, resp, nil
62 }
63
View as plain text