...
1
2
3
4
5
6 package github
7
8 import (
9 "context"
10 "fmt"
11 )
12
13
14
15
16 type ActionsPermissions struct {
17 EnabledRepositories *string `json:"enabled_repositories,omitempty"`
18 AllowedActions *string `json:"allowed_actions,omitempty"`
19 SelectedActionsURL *string `json:"selected_actions_url,omitempty"`
20 }
21
22 func (a ActionsPermissions) String() string {
23 return Stringify(a)
24 }
25
26
27
28
29 func (s *OrganizationsService) GetActionsPermissions(ctx context.Context, org string) (*ActionsPermissions, *Response, error) {
30 u := fmt.Sprintf("orgs/%v/actions/permissions", org)
31
32 req, err := s.client.NewRequest("GET", u, nil)
33 if err != nil {
34 return nil, nil, err
35 }
36
37 permissions := new(ActionsPermissions)
38 resp, err := s.client.Do(ctx, req, permissions)
39 if err != nil {
40 return nil, resp, err
41 }
42
43 return permissions, resp, nil
44 }
45
46
47
48
49 func (s *OrganizationsService) EditActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) {
50 u := fmt.Sprintf("orgs/%v/actions/permissions", org)
51 req, err := s.client.NewRequest("PUT", u, actionsPermissions)
52 if err != nil {
53 return nil, nil, err
54 }
55
56 p := new(ActionsPermissions)
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