Skip to content

Commit

Permalink
Refactor GitHubAppHelper #123
Browse files Browse the repository at this point in the history
  • Loading branch information
pdolif committed Aug 9, 2022
1 parent 97a5a61 commit 8767764
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public GitHub getGitHubInstance(String repositoryFullName) {

try {
// first create GitHub object using a JWT (this is needed to request an access token for an app installation)
GitHub gitHub = new GitHubBuilder().withJwtToken(generateJWT(gitHubAppId)).build();
GitHub gitHub = new GitHubBuilder().withJwtToken(generateJWT()).build();

// get app installation for given repository (getInstallationByRepository requires a JWT)
GHAppInstallation installation = gitHub.getApp().getInstallationByRepository(ownerName, repoName);
Expand All @@ -79,10 +79,9 @@ public GitHub getGitHubInstance(String repositoryFullName) {

/**
* Generates a JWT and signs it with the app's private key.
* @param gitHubAppId Id of the GitHub app
* @return JWT
*/
private String generateJWT(int gitHubAppId) {
private String generateJWT() {
long nowMillis = System.currentTimeMillis();
Date now = new Date(nowMillis);
Date expiration = new Date(nowMillis + 60000);
Expand Down

0 comments on commit 8767764

Please sign in to comment.