mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-10 02:15:36 +08:00
dont pass invalid empty gh token
This commit is contained in:
@@ -14,17 +14,18 @@ trait GitHubTokenSetupTrait
|
||||
public static function getGitHubTokenHeadersStatic(): array
|
||||
{
|
||||
// GITHUB_TOKEN support
|
||||
if (($token = getenv('GITHUB_TOKEN')) !== false && ($user = getenv('GITHUB_USER')) !== false) {
|
||||
$token = getenv('GITHUB_TOKEN');
|
||||
if ($token === false || $token === '') {
|
||||
return [];
|
||||
}
|
||||
if (($user = getenv('GITHUB_USER')) !== false && $user !== '') {
|
||||
logger()->debug("Using 'GITHUB_TOKEN' with user {$user} for authentication");
|
||||
$encoded = base64_encode("{$user}:{$token}");
|
||||
spc_add_log_filter([$user, $token, $encoded]);
|
||||
return ["Authorization: Basic {$encoded}"];
|
||||
}
|
||||
if (($token = getenv('GITHUB_TOKEN')) !== false) {
|
||||
logger()->debug("Using 'GITHUB_TOKEN' for authentication");
|
||||
spc_add_log_filter($token);
|
||||
return ["Authorization: Bearer {$token}"];
|
||||
}
|
||||
return [];
|
||||
logger()->debug("Using 'GITHUB_TOKEN' for authentication");
|
||||
spc_add_log_filter($token);
|
||||
return ["Authorization: Bearer {$token}"];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user