Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enterprise actions permissions endpoints #2518

Closed

Conversation

algorythmic
Copy link

Add /enterprises/ versions of the /orgs/ endpoints which have already implemented from https://docs.github.com/en/rest/actions/permissions

Since orgs_actions_permissions.go and orgs_actions_allowed.go already existed, just created enterprise_* versions of those.

The existing /orgs/{org}/actions/permissions/repositories implementation was in actions_runners.go, which doesn't seem to fit well. Rather than adding the enterprise version there as well, moved it out to orgs_actions_permissions.go, hope that's OK.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @algorythmic !

github/enterprise_actions_allowed.go Outdated Show resolved Hide resolved
github/enterprise_actions_allowed_test.go Outdated Show resolved Hide resolved
github/enterprise_actions_permissions.go Outdated Show resolved Hide resolved
// ListEnabledOrgsInEnterprise lists the selected organizations that are enabled for GitHub Actions in an enterprise.
//
// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#list-selected-organizations-enabled-for-github-actions-in-an-enterprise
func (s *ActionsService) ListEnabledOrgsInEnterprise(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnEnterpriseOrgs, *Response, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be EnterpriseService here instead of ActionsService?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention was for the new ActionsService.ListEnabledOrgsInEnterprise to mirror the existing ActionsService.ListEnabledReposInOrg, etc. since they implement the similar /enterprises/{enterprise}/actions/permissions/organizations and /orgs/{org}/actions/permissions/repositories endpoints respectively.

It would make more sense to have ListEnabledOrgsInEnterprise be an EnterpriseService method but should ListEnabledReposInOrg and friends be moved to OrganizationsService then to match?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used to determine which service an endpoint belonged to using the organization imposed by the official GitHub v3 API documentation.

Now I'm not sure that the decision is as clear-cut with the documentation site re-organization.

I'm wondering if the /enterprises/... endpoints should be in the EnterpriseService, the /orgs/... in the OrganizationsService, etc... but then am hesitant to do a complete shuffle of methods, as that is extremely disruptive to existing users.

Does anyone have thoughts or ideas on how to address this with the least amount of disruption?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if the /enterprises/... endpoints should be in the EnterpriseService, the /orgs/... in the OrganizationsService, etc... but then am hesitant to do a complete shuffle of methods, as that is extremely disruptive to existing users.

In this situation i think its a bit difficult, but if documentation is added, existing users should be able to easily migrate to the new methods. If the code is oriented on the GitHub API itself, it should make it easier for new users to archieve their goal with this library, because they know the structure from playing around with the GitHub API in curl.
Therefore I think all Services should be named by their API Endpoint whenever possible.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think my prior recommendations were incorrect. Following the documentation links, the official documentation places these endpoints under the "Actions" services, so let's please keep them there.

It looks like we now have a situation of duplicated code in two different files, so let's please resolve that problem, @algorythmic, and then we can continue with this PR.

github/enterprise_actions_permissions_test.go Outdated Show resolved Hide resolved
@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Oct 25, 2022
algorythmic and others added 4 commits October 25, 2022 14:01
Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Oct 25, 2022

Codecov Report

Merging #2518 (6ac0bf5) into master (672fd67) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #2518      +/-   ##
==========================================
+ Coverage   97.97%   97.99%   +0.01%     
==========================================
  Files         123      125       +2     
  Lines       10813    10919     +106     
==========================================
+ Hits        10594    10700     +106     
  Misses        150      150              
  Partials       69       69              
Impacted Files Coverage Δ
github/actions_runners.go 100.00% <ø> (ø)
github/enterprise_actions_allowed.go 100.00% <100.00%> (ø)
github/enterprise_actions_permissions.go 100.00% <100.00%> (ø)
github/orgs_actions_permissions.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@RickleAndMortimer
Copy link
Contributor

Is this PR still being worked on? I'd be down to help finish and close it out

@ajschmidt8
Copy link

My team could also benefit from these changes being merged.

@RickleAndMortimer, since @algorythmic is unresponsive, will you be opening a new PR to continue this work?

@RickleAndMortimer
Copy link
Contributor

For sure, I will set up a new PR for this

@gmlewis
Copy link
Collaborator

gmlewis commented Sep 18, 2023

Closing PR as abandoned.

@gmlewis gmlewis closed this Sep 18, 2023
@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants