Skip to content

Conversation

zyfy29
Copy link
Contributor

@zyfy29 zyfy29 commented Sep 26, 2025

close #3660 since this is the last part of the permissions APIs announced there

Add support for fork PR workflow permission APIs, covering 6 endpoints.

Copy link

codecov bot commented Sep 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.14%. Comparing base (b7f068f) to head (6b236e6).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3737      +/-   ##
==========================================
+ Coverage   91.11%   91.14%   +0.03%     
==========================================
  Files         187      187              
  Lines       16702    16764      +62     
==========================================
+ Hits        15218    15280      +62     
  Misses       1296     1296              
  Partials      188      188              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis
Copy link
Collaborator

gmlewis commented Sep 26, 2025

Fixes: #3660.

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Sep 26, 2025
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.

Great job, @zyfy29 - thank you!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear

}

// WorkflowApprovalPolicy represents the approval policy for workflows in a repository.
type WorkflowApprovalPolicy struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like we can think of a better name for the struct.

This struct is returned from the following functions:

  • GetForkPRContributorApprovalPermissionsInEnterprise
  • GetForkPRContributorApprovalPermissionsInOrganization
  • GetForkPRContributorApprovalPermissions

And is used as a parameter in:

  • UpdateForkPRContributorApprovalPermissionsInEnterprise
  • UpdateForkPRContributorApprovalPermissionsInOrganization
  • UpdateForkPRContributorApprovalPermissions

What about:

Suggested change
type WorkflowApprovalPolicy struct {
type ContributorApprovalPermissions struct {

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did hesitate here. ContributorApprovalPermissions is a little confusing but better fits the method name and api path. I agree with you.

@zyfy29 zyfy29 requested a review from alexandear October 3, 2025 07:10
Copy link
Contributor

@stevehipwell stevehipwell left a comment

Choose a reason for hiding this comment

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

I think I may have missed this from the other PRs but I don't feel like the In<CONTEXT> suffix feels ergonomic. The context is significant to the API call (it's the first segment) so making it the least significant part of the function name just looks a bit off.

// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-fork-pr-contributor-approval-permissions-for-an-enterprise
//
//meta:operation GET /enterprises/{enterprise}/actions/permissions/fork-pr-contributor-approval
func (s *ActionsService) GetForkPRContributorApprovalPermissionsInEnterprise(ctx context.Context, enterprise string) (*ContributorApprovalPermissions, *Response, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func (s *ActionsService) GetForkPRContributorApprovalPermissionsInEnterprise(ctx context.Context, enterprise string) (*ContributorApprovalPermissions, *Response, error) {
func (s *ActionsService) GetEnterpriseForkPRContributorApprovalPermissions(ctx context.Context, enterprise string) (*ContributorApprovalPermissions, *Response, error) {

Wouldn't the Get<CONTEXT> prefix be more consistent with the existing API design?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, thank you, @stevehipwell! Let's do this, please, @zyfy29!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsReview PR is awaiting a review before merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for new actions APIs
4 participants