Repository: google/go-github
Pull request #3108 (2024-03-21 03:12:30)

Allow Installation of Custom Properties Permissions
## Description
This PR allows app installations to request tokens with access to the Org level Custom Properties APIs

## Refs
1. [GitHub App installation access tokens](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-an-installation-access-token-for-a-github-app)
2. [API Docs](https://docs.github.com/en/rest/orgs/custom-properties?apiVersion=2022-11-28#get-a-custom-property-for-an-organization)

google-cla[bot]: 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](https://github.com/google/go-github/pull/3108/checks?check_run_id=22914375502) 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.
shellz-n-stuff: CLA Signed 🙏 
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/google/go-github/pull/3108?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 92.87%. Comparing base [(`2b8c7fa`)](https://app.codecov.io/gh/google/go-github/commit/2b8c7fa86fcd1cb4a89a44c8e7b5a49fe4be8a45?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) to head [(`9653dc8`)](https://app.codecov.io/gh/google/go-github/pull/3108?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).
> Report is 24 commits behind head on master.


<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #3108      +/-   ##
==========================================
- Coverage   97.72%   92.87%   -4.85%     
==========================================
  Files         153      170      +17     
  Lines       13390    11407    -1983     
==========================================
- Hits        13085    10594    -2491     
- Misses        215      723     +508     
  Partials       90       90              
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/google/go-github/pull/3108?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).

gmlewis: Thank you, @shellz-n-stuff !
Please run step 4 of CONTRIBUTING.md and push the changes to this PR.
shellz-n-stuff: My bad re-lint/generate. All updated 🙏 

Patch:
diff --git a/github/apps.go b/github/apps.go
index f0392f2d..2ebfee50 100644
--- a/github/apps.go
+++ b/github/apps.go
@@ -77,6 +77,7 @@ type InstallationPermissions struct {
 	Metadata                      *string `json:"metadata,omitempty"`
 	Members                       *string `json:"members,omitempty"`
 	OrganizationAdministration    *string `json:"organization_administration,omitempty"`
+	OrganizationCustomProperties  *string `json:"organization_custom_properties,omitempty"`
 	OrganizationCustomRoles       *string `json:"organization_custom_roles,omitempty"`
 	OrganizationHooks             *string `json:"organization_hooks,omitempty"`
 	OrganizationPackages          *string `json:"organization_packages,omitempty"`
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 01b81375..f95e4c3b 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -8686,6 +8686,14 @@ func (i *InstallationPermissions) GetOrganizationAdministration() string {
 	return *i.OrganizationAdministration
 }
 
+// GetOrganizationCustomProperties returns the OrganizationCustomProperties field if it's non-nil, zero value otherwise.
+func (i *InstallationPermissions) GetOrganizationCustomProperties() string {
+	if i == nil || i.OrganizationCustomProperties == nil {
+		return ""
+	}
+	return *i.OrganizationCustomProperties
+}
+
 // GetOrganizationCustomRoles returns the OrganizationCustomRoles field if it's non-nil, zero value otherwise.
 func (i *InstallationPermissions) GetOrganizationCustomRoles() string {
 	if i == nil || i.OrganizationCustomRoles == nil {


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index ba328735..ca263064 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -10177,6 +10177,16 @@ func TestInstallationPermissions_GetOrganizationAdministration(tt *testing.T) {
 	i.GetOrganizationAdministration()
 }
 
+func TestInstallationPermissions_GetOrganizationCustomProperties(tt *testing.T) {
+	var zeroValue string
+	i := &InstallationPermissions{OrganizationCustomProperties: &zeroValue}
+	i.GetOrganizationCustomProperties()
+	i = &InstallationPermissions{}
+	i.GetOrganizationCustomProperties()
+	i = nil
+	i.GetOrganizationCustomProperties()
+}
+
 func TestInstallationPermissions_GetOrganizationCustomRoles(tt *testing.T) {
 	var zeroValue string
 	i := &InstallationPermissions{OrganizationCustomRoles: &zeroValue}