Skip to content

feat: Add GitHub App Enterprise perm scope#4343

Open
eroullit wants to merge 1 commit into
google:masterfrom
eroullit:master
Open

feat: Add GitHub App Enterprise perm scope#4343
eroullit wants to merge 1 commit into
google:masterfrom
eroullit:master

Conversation

@eroullit

Copy link
Copy Markdown

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

google-cla Bot commented Jun 30, 2026

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

codecov Bot 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 (5c01031).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4343   +/-   ##
=======================================
  Coverage   97.50%   97.50%           
=======================================
  Files         193      193           
  Lines       19451    19451           
=======================================
  Hits        18965    18965           
  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.

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.

2 participants