diff --git a/github/actions_permissions_enterprise.go b/github/actions_permissions_enterprise.go index 8a5f211a429..8311e729438 100644 --- a/github/actions_permissions_enterprise.go +++ b/github/actions_permissions_enterprise.go @@ -29,10 +29,10 @@ func (a ActionsPermissionsEnterprise) String() string { return Stringify(a) } -// GetActionsPermissionsForEnterprise gets the GitHub Actions permissions policy for an enterprise. +// GetActionsPermissionsInEnterprise gets the GitHub Actions permissions policy for an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-github-actions-permissions-for-an-enterprise -func (s *ActionsService) GetActionsPermissionsForEnterprise(ctx context.Context, enterprise string) (*ActionsPermissionsEnterprise, *Response, error) { +func (s *ActionsService) GetActionsPermissionsInEnterprise(ctx context.Context, enterprise string) (*ActionsPermissionsEnterprise, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) req, err := s.client.NewRequest("GET", u, nil) @@ -49,10 +49,10 @@ func (s *ActionsService) GetActionsPermissionsForEnterprise(ctx context.Context, return permissions, resp, nil } -// EditActionsPermissionsForEnterprise sets the permissions policy in an enterprise. +// EditActionsPermissionsInEnterprise sets the permissions policy in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-github-actions-permissions-for-an-enterprise -func (s *ActionsService) EditActionsPermissionsForEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) { +func (s *ActionsService) EditActionsPermissionsInEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) req, err := s.client.NewRequest("PUT", u, actionsPermissionsEnterprise) if err != nil { @@ -151,10 +151,10 @@ func (s *ActionsService) RemoveEnabledOrgInEnterprise(ctx context.Context, owner return resp, nil } -// GetActionsAllowedForEnterprise gets the actions that are allowed in an enterprise. +// GetActionsAllowedInEnterprise gets the actions that are allowed in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-enterprise -func (s *ActionsService) GetActionsAllowedForEnterprise(ctx context.Context, enterprise string) (*ActionsAllowed, *Response, error) { +func (s *ActionsService) GetActionsAllowedInEnterprise(ctx context.Context, enterprise string) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) req, err := s.client.NewRequest("GET", u, nil) @@ -171,10 +171,10 @@ func (s *ActionsService) GetActionsAllowedForEnterprise(ctx context.Context, ent return actionsAllowed, resp, nil } -// EditActionsAllowedForEnterprise sets the actions that are allowed in an enterprise. +// EditActionsAllowedInEnterprise sets the actions that are allowed in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-enterprise -func (s *ActionsService) EditActionsAllowedForEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { +func (s *ActionsService) EditActionsAllowedInEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) req, err := s.client.NewRequest("PUT", u, actionsAllowed) if err != nil { diff --git a/github/actions_permissions_enterprise_test.go b/github/actions_permissions_enterprise_test.go index cd4956035df..14e8e3a6b33 100644 --- a/github/actions_permissions_enterprise_test.go +++ b/github/actions_permissions_enterprise_test.go @@ -15,7 +15,7 @@ import ( "github.com/google/go-cmp/cmp" ) -func TestActionsService_GetActionsPermissionsForEnterprise(t *testing.T) { +func TestActionsService_GetActionsPermissionsInEnterprise(t *testing.T) { client, mux, _, teardown := setup() defer teardown() @@ -25,23 +25,23 @@ func TestActionsService_GetActionsPermissionsForEnterprise(t *testing.T) { }) ctx := context.Background() - ent, _, err := client.Actions.GetActionsPermissionsForEnterprise(ctx, "e") + ent, _, err := client.Actions.GetActionsPermissionsInEnterprise(ctx, "e") if err != nil { - t.Errorf("Actions.GetActionsPermissionsForEnterprise returned error: %v", err) + t.Errorf("Actions.GetActionsPermissionsInEnterprise returned error: %v", err) } want := &ActionsPermissionsEnterprise{EnabledOrganizations: String("all"), AllowedActions: String("all")} if !cmp.Equal(ent, want) { - t.Errorf("Actions.GetActionsPermissionsForEnterprise returned %+v, want %+v", ent, want) + t.Errorf("Actions.GetActionsPermissionsInEnterprise returned %+v, want %+v", ent, want) } - const methodName = "GetActionsPermissionsForEnterprise" + const methodName = "GetActionsPermissionsInEnterprise" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.GetActionsPermissionsForEnterprise(ctx, "\n") + _, _, err = client.Actions.GetActionsPermissionsInEnterprise(ctx, "\n") return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Actions.GetActionsPermissionsForEnterprise(ctx, "e") + got, resp, err := client.Actions.GetActionsPermissionsInEnterprise(ctx, "e") if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -49,7 +49,7 @@ func TestActionsService_GetActionsPermissionsForEnterprise(t *testing.T) { }) } -func TestActionsService_EditActionsPermissionsForEnterprise(t *testing.T) { +func TestActionsService_EditActionsPermissionsInEnterprise(t *testing.T) { client, mux, _, teardown := setup() defer teardown() @@ -68,24 +68,24 @@ func TestActionsService_EditActionsPermissionsForEnterprise(t *testing.T) { }) ctx := context.Background() - ent, _, err := client.Actions.EditActionsPermissionsForEnterprise(ctx, "e", *input) + ent, _, err := client.Actions.EditActionsPermissionsInEnterprise(ctx, "e", *input) if err != nil { - t.Errorf("Actions.EditActionsPermissionsForEnterprise returned error: %v", err) + t.Errorf("Actions.EditActionsPermissionsInEnterprise returned error: %v", err) } want := &ActionsPermissionsEnterprise{EnabledOrganizations: String("all"), AllowedActions: String("selected")} if !cmp.Equal(ent, want) { - t.Errorf("Actions.EditActionsPermissionsForEnterprise returned %+v, want %+v", ent, want) + t.Errorf("Actions.EditActionsPermissionsInEnterprise returned %+v, want %+v", ent, want) } - const methodName = "EditActionsPermissionsForEnterprise" + const methodName = "EditActionsPermissionsInEnterprise" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.EditActionsPermissionsForEnterprise(ctx, "\n", *input) + _, _, err = client.Actions.EditActionsPermissionsInEnterprise(ctx, "\n", *input) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Actions.EditActionsPermissionsForEnterprise(ctx, "e", *input) + got, resp, err := client.Actions.EditActionsPermissionsInEnterprise(ctx, "e", *input) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -220,7 +220,7 @@ func TestActionsService_RemoveEnabledOrgInEnterprise(t *testing.T) { }) } -func TestActionsService_GetActionsAllowedForEnterprise(t *testing.T) { +func TestActionsService_GetActionsAllowedInEnterprise(t *testing.T) { client, mux, _, teardown := setup() defer teardown() @@ -230,23 +230,23 @@ func TestActionsService_GetActionsAllowedForEnterprise(t *testing.T) { }) ctx := context.Background() - ent, _, err := client.Actions.GetActionsAllowedForEnterprise(ctx, "e") + ent, _, err := client.Actions.GetActionsAllowedInEnterprise(ctx, "e") if err != nil { - t.Errorf("Actions.GetActionsAllowedForEnterprise returned error: %v", err) + t.Errorf("Actions.GetActionsAllowedInEnterprise returned error: %v", err) } want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(ent, want) { - t.Errorf("Actions.GetActionsAllowedForEnterprise returned %+v, want %+v", ent, want) + t.Errorf("Actions.GetActionsAllowedInEnterprise returned %+v, want %+v", ent, want) } - const methodName = "GetActionsAllowedForEnterprise" + const methodName = "GetActionsAllowedInEnterprise" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.GetActionsAllowedForEnterprise(ctx, "\n") + _, _, err = client.Actions.GetActionsAllowedInEnterprise(ctx, "\n") return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Actions.GetActionsAllowedForEnterprise(ctx, "e") + got, resp, err := client.Actions.GetActionsAllowedInEnterprise(ctx, "e") if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -254,7 +254,7 @@ func TestActionsService_GetActionsAllowedForEnterprise(t *testing.T) { }) } -func TestActionsService_EditActionsAllowedForEnterprise(t *testing.T) { +func TestActionsService_EditActionsAllowedInEnterprise(t *testing.T) { client, mux, _, teardown := setup() defer teardown() input := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} @@ -272,24 +272,24 @@ func TestActionsService_EditActionsAllowedForEnterprise(t *testing.T) { }) ctx := context.Background() - ent, _, err := client.Actions.EditActionsAllowedForEnterprise(ctx, "e", *input) + ent, _, err := client.Actions.EditActionsAllowedInEnterprise(ctx, "e", *input) if err != nil { - t.Errorf("Actions.EditActionsAllowedForEnterprise returned error: %v", err) + t.Errorf("Actions.EditActionsAllowedInEnterprise returned error: %v", err) } want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} if !cmp.Equal(ent, want) { - t.Errorf("Actions.EditActionsAllowedForEnterprise returned %+v, want %+v", ent, want) + t.Errorf("Actions.EditActionsAllowedInEnterprise returned %+v, want %+v", ent, want) } - const methodName = "EditActionsAllowedForEnterprise" + const methodName = "EditActionsAllowedInEnterprise" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.EditActionsAllowedForEnterprise(ctx, "\n", *input) + _, _, err = client.Actions.EditActionsAllowedInEnterprise(ctx, "\n", *input) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Actions.EditActionsAllowedForEnterprise(ctx, "e", *input) + got, resp, err := client.Actions.EditActionsAllowedInEnterprise(ctx, "e", *input) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } diff --git a/github/actions_permissions_orgs.go b/github/actions_permissions_orgs.go index ff00fc405f8..e427824bbce 100644 --- a/github/actions_permissions_orgs.go +++ b/github/actions_permissions_orgs.go @@ -84,7 +84,7 @@ func (s *ActionsService) EditActionsPermissions(ctx context.Context, org string, // ListEnabledRepos lists the selected repositories that are enabled for GitHub Actions in an organization. // // GitHub API docs: https://docs.github.com/en/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization -func (s *ActionsService) ListEnabledRepos(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) { +func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) u, err := addOptions(u, opts) if err != nil { @@ -108,7 +108,7 @@ func (s *ActionsService) ListEnabledRepos(ctx context.Context, owner string, opt // SetEnabledRepos replaces the list of selected repositories that are enabled for GitHub Actions in an organization.. // // GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization -func (s *ActionsService) SetEnabledRepos(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) { +func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) req, err := s.client.NewRequest("PUT", u, struct { @@ -129,7 +129,7 @@ func (s *ActionsService) SetEnabledRepos(ctx context.Context, owner string, repo // AddEnabledRepos adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. // // GitHub API docs: https://docs.github.com/en/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization -func (s *ActionsService) AddEnabledRepos(ctx context.Context, owner string, repositoryID int64) (*Response, error) { +func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) req, err := s.client.NewRequest("PUT", u, nil) @@ -148,7 +148,7 @@ func (s *ActionsService) AddEnabledRepos(ctx context.Context, owner string, repo // RemoveEnabledRepo removes a single repository from the list of enabled repos for GitHub Actions in an organization. // // GitHub API docs: https://docs.github.com/en/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization -func (s *ActionsService) RemoveEnabledRepo(ctx context.Context, owner string, repositoryID int64) (*Response, error) { +func (s *ActionsService) RemoveEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/actions_permissions_orgs_test.go b/github/actions_permissions_orgs_test.go index da4ececc48f..ade02cc8d93 100644 --- a/github/actions_permissions_orgs_test.go +++ b/github/actions_permissions_orgs_test.go @@ -93,7 +93,7 @@ func TestActionsService_EditActionsPermissions(t *testing.T) { }) } -func TestActionsService_ListEnabledRepos(t *testing.T) { +func TestActionsService_ListEnabledReposInOrg(t *testing.T) { client, mux, _, teardown := setup() defer teardown() @@ -109,7 +109,7 @@ func TestActionsService_ListEnabledRepos(t *testing.T) { opt := &ListOptions{ Page: 1, } - got, _, err := client.Actions.ListEnabledRepos(ctx, "o", opt) + got, _, err := client.Actions.ListEnabledReposInOrg(ctx, "o", opt) if err != nil { t.Errorf("Actions.ListEnabledRepos returned error: %v", err) } @@ -124,12 +124,12 @@ func TestActionsService_ListEnabledRepos(t *testing.T) { const methodName = "ListEnabledRepos" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.ListEnabledRepos(ctx, "\n", opt) + _, _, err = client.Actions.ListEnabledReposInOrg(ctx, "\n", opt) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Actions.ListEnabledRepos(ctx, "o", opt) + got, resp, err := client.Actions.ListEnabledReposInOrg(ctx, "o", opt) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -137,7 +137,7 @@ func TestActionsService_ListEnabledRepos(t *testing.T) { }) } -func TestActionsService_SetEnabledRepos(t *testing.T) { +func TestActionsService_SetEnabledReposInOrg(t *testing.T) { client, mux, _, teardown := setup() defer teardown() @@ -149,7 +149,7 @@ func TestActionsService_SetEnabledRepos(t *testing.T) { }) ctx := context.Background() - _, err := client.Actions.SetEnabledRepos(ctx, "o", []int64{123, 1234}) + _, err := client.Actions.SetEnabledReposInOrg(ctx, "o", []int64{123, 1234}) if err != nil { t.Errorf("Actions.SetEnabledRepos returned error: %v", err) } @@ -157,16 +157,16 @@ func TestActionsService_SetEnabledRepos(t *testing.T) { const methodName = "SetEnabledRepos" testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.SetEnabledRepos(ctx, "\n", []int64{123, 1234}) + _, err = client.Actions.SetEnabledReposInOrg(ctx, "\n", []int64{123, 1234}) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.SetEnabledRepos(ctx, "o", []int64{123, 1234}) + return client.Actions.SetEnabledReposInOrg(ctx, "o", []int64{123, 1234}) }) } -func TestActionsService_AddEnabledRepos(t *testing.T) { +func TestActionsService_AddEnabledReposInOrg(t *testing.T) { client, mux, _, teardown := setup() defer teardown() @@ -176,7 +176,7 @@ func TestActionsService_AddEnabledRepos(t *testing.T) { }) ctx := context.Background() - _, err := client.Actions.AddEnabledRepos(ctx, "o", 123) + _, err := client.Actions.AddEnabledReposInOrg(ctx, "o", 123) if err != nil { t.Errorf("Actions.AddEnabledRepos returned error: %v", err) } @@ -184,16 +184,16 @@ func TestActionsService_AddEnabledRepos(t *testing.T) { const methodName = "AddEnabledRepos" testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.AddEnabledRepos(ctx, "\n", 123) + _, err = client.Actions.AddEnabledReposInOrg(ctx, "\n", 123) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.AddEnabledRepos(ctx, "o", 123) + return client.Actions.AddEnabledReposInOrg(ctx, "o", 123) }) } -func TestActionsService_RemoveEnabledRepo(t *testing.T) { +func TestActionsService_RemoveEnabledReposInOrg(t *testing.T) { client, mux, _, teardown := setup() defer teardown() @@ -203,7 +203,7 @@ func TestActionsService_RemoveEnabledRepo(t *testing.T) { }) ctx := context.Background() - _, err := client.Actions.RemoveEnabledRepo(ctx, "o", 123) + _, err := client.Actions.RemoveEnabledReposInOrg(ctx, "o", 123) if err != nil { t.Errorf("Actions.RemoveEnabledRepo returned error: %v", err) } @@ -211,12 +211,12 @@ func TestActionsService_RemoveEnabledRepo(t *testing.T) { const methodName = "RemoveEnabledRepo" testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.RemoveEnabledRepo(ctx, "\n", 123) + _, err = client.Actions.RemoveEnabledReposInOrg(ctx, "\n", 123) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.RemoveEnabledRepo(ctx, "o", 123) + return client.Actions.RemoveEnabledReposInOrg(ctx, "o", 123) }) }