Skip to content

feat: Add GitHub App Enterprise perm scope - #4343

Merged
gmlewis merged 3 commits into
google:masterfrom
eroullit:master
Jul 7, 2026
Merged

feat: Add GitHub App Enterprise perm scope#4343
gmlewis merged 3 commits into
google:masterfrom
eroullit:master

Conversation

@eroullit

Copy link
Copy Markdown
Contributor

This pull request adds support for several new enterprise-related permission fields to the InstallationPermissions struct, along with corresponding accessor methods and unit tests. These changes enhance the codebase to handle a wider range of GitHub App installation permissions, particularly for enterprise features.

Creating a installation token yields this output when enterprise-scope permissions are used:

{
"token": "ghs_etcetc",
"expires_at": "2026-06-30T14:28:23Z",
"permissions": {
"enterprise_ai_controls": "read",
"enterprise_copilot_metrics": "read",
"enterprise_credentials": "read",
"enterprise_custom_enterprise_roles": "read",
"enterprise_custom_org_roles": "read",
"enterprise_custom_properties": "read",
"enterprise_custom_properties_for_organizations": "read",
"enterprise_organizations": "write",
"enterprise_organization_installations": "read",
"enterprise_organization_installation_repositories": "read",
"enterprise_people": "read",
"enterprise_sso": "read",
"enterprise_teams": "read"
},
"repository_selection": "selected"
}

Previously, these information were omitted when go-github is in used.

Enterprise permissions support:

  • Added new fields to the InstallationPermissions struct for various enterprise-related permissions, such as EnterpriseAIControls, EnterpriseCopilotMetrics, EnterpriseCredentials, and others. (github/apps.go)
  • Implemented getter methods for each new enterprise permission field to safely retrieve their values. (github/github-accessors.go)

Testing:

  • Added unit tests for each new getter method to ensure correct behavior when fields are set, unset, or the struct is nil. (github/github-accessors_test.go)

@google-cla

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@codecov

codecovBot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.50%. Comparing base (7a388ca) to head (c8d798e).
⚠️ Report is 10 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@## master #4343 +/- ##
=======================================
Coverage 97.50% 97.50% =======================================
Files 193 193 Lines 19451 19481 +30 =======================================
+ Hits 18965 18995 +30 
Misses 269 269 Partials 217 217 

☔ View full report in Codecov by Harness.
📢 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.

@eroullit

Copy link
Copy Markdown
ContributorAuthor

Hi @gmlewis 👋

I did register for an individual CLA triggering an the new contributor update does not seem to proceed 🙏

Comment threadgithub/apps.go
Deployments *string `json:"deployments,omitempty"`
Discussions *string `json:"discussions,omitempty"`
Emails *string `json:"emails,omitempty"`
EnterpriseAIControls *string `json:"enterprise_ai_controls,omitempty"`

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Linter fails at:

"EnterpriseAIControls" to "EnterpriseAiControls"

Artificial Intelligence (AI) is universally capitalized.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To fix it, add "AI": true, to the list of initialisms

varinitialisms=map[string]bool{

Keep the list sorted.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Added with c8d798e

@gmlewisgmlewis added NeedsReview PR is awaiting a review before merging. and removed waiting for signed CLA labels Jul 1, 2026

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @eroullit!
LGTM.

cc: @alexandear

@gmlewis
gmlewis merged commit b44ebf5 into google:masterJul 7, 2026
15 checks passed
@gmlewisgmlewis removed the NeedsReview PR is awaiting a review before merging. label Jul 7, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@eroullit@alexandear@gmlewis