Skip to content

Commit

Permalink
Throw exception if access token not generated
Browse files Browse the repository at this point in the history
  • Loading branch information
vermakhushboo committed May 17, 2024
1 parent b682863 commit 3b54947
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/VCS/Adapter/Git/GitHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,10 @@ protected function generateAccessToken(string $privateKey, string $githubAppId):
$token = $jwt->encode($payload);
$this->jwtToken = $token;
$res = $this->call(self::METHOD_POST, '/app/installations/' . $this->installationId . '/access_tokens', ['Authorization' => 'Bearer ' . $token]);
$this->accessToken = $res['body']['token'] ?? '';
if (!isset($res['body']['token'])) {
throw new Exception('Failed to retrieve access token from GitHub API.');
}
$this->accessToken = $res['body']['token'];
}

/**
Expand Down

0 comments on commit 3b54947

Please sign in to comment.