Uh oh!
There was an error while loading. Please reload this page.
Add Organization PAT fields to InstallationPermissions struct - #3243
Conversation
In the article "[Organization APIs for fine-grained PATs management](https://github.blog/changelog/2023-03-24-organization-apis-for-fine-grained-pats-management/)", following new 2 permissions are added to GitHub Apps - organization_personal_access_tokens - organization_personal_access_token_requests These permissions are used for getting and updating GitHub Organization's Fine-grained PAT's lists, requests, revokes. [APIs of Organization permissions for "Personal access tokens"](https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps?apiVersion=2022-11-28#organization-permissions-for-personal-access-tokens) [APIs of Organization permissions for "Personal access token requests"](https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps?apiVersion=2022-11-28#organization-permissions-for-personal-access-token-requests) We can test these permissions following test codes, and successfully I got installation token from GitHub. ```go package main import ( "context" "log" "net/http" "github.com/bradleyfalzon/ghinstallation/v2" "github.com/google/go-github/v64/github" ) func main() { ctx := context.Background() tr := http.DefaultTransport itr, err := ghinstallation.NewAppsTransportKeyFromFile(tr, <your-app-id>, <your-private-key-path>) if err != nil { log.Fatal(err) } client := github.NewClient(&http.Client{Transport: itr}) token, _, err := client.Apps.CreateInstallationToken( ctx, <your-installation-id>, &github.InstallationTokenOptions{ Permissions: &github.InstallationPermissions{ OrganizationPersonalAccessTokens: github.String("read"), OrganizationPersonalAccessTokenRequests: github.String("read"), }, }) if err != nil { log.Fatal(err) } log.Println(token.GetToken()) } ``` Signed-off-by: Hi120ki <12624257+hi120ki@users.noreply.github.com>
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. |
gmlewis
commented
Aug 21, 2024
Thank you, @hi120ki ! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## master #3243 +/- ##
==========================================
- Coverage 97.72% 92.95% -4.78%
==========================================
Files 153 171 +18 Lines 13390 11646 -1744 ==========================================
- Hits 13085 10825 -2260 - Misses 215 727 +512 - Partials 90 94 +4 ☔ View full report in Codecov by Sentry. |
…, and passed the test and lint I checked following commands are passed. ``` $ script/fmt.sh $ script/test.sh $ script/lint.sh ``` Signed-off-by: Hi120ki <12624257+hi120ki@users.noreply.github.com>
In the article "Organization APIs for fine-grained PATs management", following new 2 permissions are added to GitHub Apps
These permissions are used for getting and updating GitHub Organization's Fine-grained PAT's lists, requests, revokes.
APIs of Organization permissions for "Personal access tokens"
APIs of Organization permissions for "Personal access token requests"
We can test these permissions following test codes, and successfully I got installation token from GitHub.