chore: remove debug log, finally found it
This commit is contained in:
@@ -15,23 +15,11 @@ use Lcobucci\JWT\Token\Builder;
|
||||
|
||||
function generateGithubToken(GithubApp $source, string $type)
|
||||
{
|
||||
Log::debug('Generating GitHub token', [
|
||||
'app_id' => $source->app_id,
|
||||
'type' => $type,
|
||||
'api_url' => $source->api_url,
|
||||
]);
|
||||
|
||||
$response = Http::get("{$source->api_url}/zen");
|
||||
$serverTime = CarbonImmutable::now()->setTimezone('UTC');
|
||||
$githubTime = Carbon::parse($response->header('date'));
|
||||
$timeDiff = abs($serverTime->diffInSeconds($githubTime));
|
||||
|
||||
Log::debug('Time synchronization check', [
|
||||
'server_time' => $serverTime->format('Y-m-d H:i:s'),
|
||||
'github_time' => $githubTime->format('Y-m-d H:i:s'),
|
||||
'difference_seconds' => $timeDiff,
|
||||
]);
|
||||
|
||||
if ($timeDiff > 50) {
|
||||
Log::error('System time out of sync with GitHub', [
|
||||
'time_difference' => $timeDiff,
|
||||
@@ -60,20 +48,9 @@ function generateGithubToken(GithubApp $source, string $type)
|
||||
->getToken($algorithm, $signingKey)
|
||||
->toString();
|
||||
|
||||
Log::debug('JWT token generated', [
|
||||
'token_type' => $type,
|
||||
'issued_at' => $now->modify('-1 minute')->format('Y-m-d H:i:s'),
|
||||
'expires_at' => $now->modify('+8 minutes')->format('Y-m-d H:i:s'),
|
||||
]);
|
||||
|
||||
return match ($type) {
|
||||
'jwt' => $jwt,
|
||||
'installation' => (function () use ($source, $jwt) {
|
||||
Log::debug('Requesting installation token', [
|
||||
'app_id' => $source->app_id,
|
||||
'installation_id' => $source->installation_id,
|
||||
]);
|
||||
|
||||
$response = Http::withHeaders([
|
||||
'Authorization' => "Bearer $jwt",
|
||||
'Accept' => 'application/vnd.github.machine-man-preview+json',
|
||||
@@ -89,10 +66,6 @@ function generateGithubToken(GithubApp $source, string $type)
|
||||
throw new RuntimeException("Failed to get installation token for {$source->name} with error: ".$error);
|
||||
}
|
||||
|
||||
Log::debug('Successfully obtained installation token', [
|
||||
'app_id' => $source->app_id,
|
||||
]);
|
||||
|
||||
return $response->json()['token'];
|
||||
})(),
|
||||
default => throw new \InvalidArgumentException("Unsupported token type: {$type}")
|
||||
|
Reference in New Issue
Block a user