github-api
github-api copied to clipboard
Add support for repositories body parameter when creating installation access tokens
Description
This PR adds support for the repositories
body parameter as specified in https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app to GHAppCreateTokenBuilder
.
Originally, if you wanted to generate an installation access token limited to a specific repository, the /app/installations/{installation_id}/access_tokens
endpoint required you to pass a repository_ids
body parameter. That parameter is a bit awkward because generally you will need to make an additional API call to retrieve the ID of a repository given its name.
At some point (I could not find a changelog) GitHub added a repositories
body parameter that works like repository_ids
, but accepts repository names rather than IDs, which is a nice improvement.
Before submitting a PR:
- [x] Changes must not break binary backwards compatibility. If you are unclear on how to make the change you think is needed while maintaining backward compatibility, CONTRIBUTING.md for details.
- [x] Add JavaDocs and other comments as appropriate. Consider including links in comments to relevant documentation on https://docs.github.com/en/rest .
- [x] Add tests that cover any added or changed code. This generally requires capturing snapshot test data. See CONTRIBUTING.md for details.
- [x] Run
mvn -D enable-ci clean install site
locally. If this command doesn't succeed, your change will not pass CI. - [x] Push your changes to a branch other than
main
. You will create your PR from that branch.
When creating a PR:
- [x] Fill in the "Description" above with clear summary of the changes. This includes:
- [ ] If this PR fixes one or more issues, include "Fixes #
" lines for each issue. - [x] Provide links to relevant documentation on https://docs.github.com/en/rest where possible.
- [ ] If this PR fixes one or more issues, include "Fixes #
- [x] All lines of new code should be covered by tests as reported by code coverage. Any lines that are not covered must have PR comments explaining why they cannot be covered. For example, "Reaching this particular exception is hard and is not a particular common scenario."
- [x] Enable "Allow edits from maintainers".
Codecov Report
Merging #1492 (bd27d76) into main (08785e5) will increase coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #1492 +/- ##
=========================================
Coverage 78.80% 78.81%
- Complexity 2113 2114 +1
=========================================
Files 202 202
Lines 6427 6429 +2
Branches 361 361
=========================================
+ Hits 5065 5067 +2
Misses 1152 1152
Partials 210 210
Impacted Files | Coverage Δ | |
---|---|---|
...va/org/kohsuke/github/GHAppCreateTokenBuilder.java | 85.71% <100.00%> (+1.50%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.