Skip to content

refactor!: Rename InstallationTokenOptions and InstallationTokenListRepoOptions to ...Request types and pass them by value - #4700

Open
JamBalaya56562 wants to merge 1 commit into
google:masterfrom
JamBalaya56562:refactor/3644-installation-token-request-types
Open

JamBalaya56562 wants to merge 1 commit into
google:masterfrom
JamBalaya56562:refactor/3644-installation-token-request-types

Conversation

@JamBalaya56562

@JamBalaya56562 JamBalaya56562 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Updates #3644.

BREAKING CHANGE: InstallationTokenOptions is renamed to CreateInstallationTokenRequest and InstallationTokenListRepoOptions is renamed to CreateInstallationTokenListReposRequest; AppsService.CreateInstallationToken and AppsService.CreateInstallationTokenListRepos now take them by value.

Both methods use POST /app/installations/{installation_id}/access_tokens, whose request body schema has only the optional repositories, repository_ids, and permissions, so no fields are added or removed. The JSON tags are not changed either: CreateInstallationTokenListReposRequest.RepositoryIDs keeps sending repository_ids when it is nil or empty, which is why the method was added in #3155 (for #3106). Since script/check-schema-fields.sh now checks this method and warns that the field has no omitzero, the field is added to tools/schemafields/exceptions.txt with that reason.

With a value parameter, the zero value now sends a body instead of no body: {} for CreateInstallationToken and {"repository_ids":null} for CreateInstallationTokenListRepos, the same body as passing an empty struct before. I checked with a throwaway GitHub App (Metadata read, one selected repository) that no body, {}, {"repository_ids":null}, and {"repository_ids":[]} all return the same 201 response, and that each token can access the same repositories (GET /installation/repositories). InstallationTokenOptions and InstallationTokenListRepoOptions are removed from body-allowed-pointer-types and body-allowed-wrong-names, and the tests check the request body with testJSONBody.

The method names already start with the verb of the GitHub docs operation name ("Create an installation access token for an app"), so they are not renamed.

Verified locally: go build ./..., go vet -tags integration ./test/integration/, example module build, go test ./github/, generated files idempotent, custom-gcl 0 issues, and script/check-schema-fields.sh reports nothing for these types. (It still reports the 4 EnterpriseUpdateBudget warnings that master has since #4693; #4699 fixes them.)

…stRepoOptions` to `...Request` types and pass them by value
@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Oct 31, 2026
@codecov

codecov Bot commented Oct 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.64%. Comparing base (eeb77ef) to head (656ce72).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4700   +/-   ##
=======================================
  Coverage   98.64%   98.64%           
=======================================
  Files         203      203           
  Lines       19027    19027           
=======================================
  Hits        18769    18769           
  Misses        258      258           

☔ 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

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants