Skip to content

Commit

Permalink
readded old orgs_actions_permissions as deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
RickleAndMortimer committed Sep 26, 2023
1 parent dde3ba2 commit 18b5850
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 8 deletions.
8 changes: 4 additions & 4 deletions github/actions_permissions_orgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (s *ActionsService) EditActionsPermissions(ctx context.Context, org string,
return p, resp, nil
}

// ListEnabledRepos lists the selected repositories that are enabled for GitHub Actions in an organization.
// ListEnabledReposInOrg 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) ListEnabledReposInOrg(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) {
Expand All @@ -105,7 +105,7 @@ func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string
return repos, resp, nil
}

// SetEnabledRepos replaces the list of selected repositories that are enabled for GitHub Actions in an organization..
// SetEnabledReposInOrg 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) SetEnabledReposInOrg(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) {
Expand All @@ -126,7 +126,7 @@ func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string,
return resp, nil
}

// AddEnabledRepos adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization.
// AddEnabledReposInOrg 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) AddEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) {
Expand All @@ -145,7 +145,7 @@ func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string,
return resp, nil
}

// RemoveEnabledRepo removes a single repository from the list of enabled repos for GitHub Actions in an organization.
// RemoveEnabledRepoInOrg 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) RemoveEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) {
Expand Down
8 changes: 4 additions & 4 deletions github/actions_permissions_orgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ func TestActionsService_AddEnabledReposInOrg(t *testing.T) {
ctx := context.Background()
_, err := client.Actions.AddEnabledReposInOrg(ctx, "o", 123)
if err != nil {
t.Errorf("Actions.AddEnabledRepos returned error: %v", err)
t.Errorf("Actions.AddEnabledReposInOrg returned error: %v", err)
}

const methodName = "AddEnabledRepos"
const methodName = "AddEnabledReposInOrg"

testBadOptions(t, methodName, func() (err error) {
_, err = client.Actions.AddEnabledReposInOrg(ctx, "\n", 123)
Expand All @@ -205,10 +205,10 @@ func TestActionsService_RemoveEnabledReposInOrg(t *testing.T) {
ctx := context.Background()
_, err := client.Actions.RemoveEnabledReposInOrg(ctx, "o", 123)
if err != nil {
t.Errorf("Actions.RemoveEnabledRepo returned error: %v", err)
t.Errorf("Actions.RemoveEnabledReposInOrg returned error: %v", err)
}

const methodName = "RemoveEnabledRepo"
const methodName = "RemoveEnabledReposInOrg"

testBadOptions(t, methodName, func() (err error) {
_, err = client.Actions.RemoveEnabledReposInOrg(ctx, "\n", 123)
Expand Down
28 changes: 28 additions & 0 deletions github/orgs_actions_allowed.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2021 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
"context"
)

// GetActionsAllowed gets the actions that are allowed in an organization.
//
// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization
// Deprecated: please use `client.Actions.GetActionsAllowed` instead
func (s *OrganizationsService) GetActionsAllowed(ctx context.Context, org string) (*ActionsAllowed, *Response, error) {
s2 := (*ActionsService)(s)
return s2.GetActionsAllowed(ctx, org)
}

// EditActionsAllowed sets the actions that are allowed in an organization.
//
// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization
// Deprecated: please use `client.Actions.EditActionsAllowed` instead
func (s *OrganizationsService) EditActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) {
s2 := (*ActionsService)(s)
return s2.EditActionsAllowed(ctx, org, actionsAllowed)
}
28 changes: 28 additions & 0 deletions github/orgs_actions_permisssions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2021 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
"context"
)

// GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in an organization.
//
// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-github-actions-permissions-for-an-organization
// Deprecated: please use `client.Actions.GetActionsPermissions` instead
func (s *OrganizationsService) GetActionsPermissions(ctx context.Context, org string) (*ActionsPermissions, *Response, error) {
s2 := (*ActionsService)(s)
return s2.GetActionsPermissions(ctx, org)
}

// EditActionsPermissions sets the permissions policy for repositories and allowed actions in an organization.
//
// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-github-actions-permissions-for-an-organization
// Deprecated: please use `client.Actions.EditActionsPermissions` instead
func (s *OrganizationsService) EditActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) {
s2 := (*ActionsService)(s)
return s2.EditActionsPermissions(ctx, org, actionsPermissions)
}

0 comments on commit 18b5850

Please sign in to comment.