New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for repositories body parameter when creating installation access tokens #1492
Add support for repositories body parameter when creating installation access tokens #1492
Conversation
* Array containing the repository names | ||
* @return a GHAppCreateTokenBuilder | ||
*/ | ||
@BetaApi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a bit of reading I think this API is out of beta now, but I added this annotation anyways to match the other methods in this class. Let me know if I should remove the annotation or anything.
@Test | ||
public void createTokenWithRepositories() throws IOException { | ||
GHApp app = gitHub.getApp(); | ||
GHAppInstallation installation = app.getInstallationByUser("bogus"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDK if this is the preferred approach, but it matches the above createToken
test (I ran it against a real app and everything though when generating the stubs and then just changed the names to match the other test).
Codecov Report
@@ 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
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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 toGHAppCreateTokenBuilder
.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 arepository_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 likerepository_ids
, but accepts repository names rather than IDs, which is a nice improvement.Before submitting a PR:
mvn -D enable-ci clean install site
locally. If this command doesn't succeed, your change will not pass CI.main
. You will create your PR from that branch.When creating a PR: