fix(gitlab): check the private key before using it for git commands

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2026-09-28 14:06:14 +02:00
co-authored by Claude Opus 5.5
parent 739d9e9d23
commit 7c21c330c9
3 changed files with 45 additions and 2 deletions
+8
View File
@@ -1,6 +1,7 @@
<?php
use App\Models\GitlabApp;
use App\Models\PrivateKey;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Http;
@@ -83,6 +84,13 @@ function gitlabApi(GitlabApp $source, string $endpoint, string $method = 'get',
];
}
function gitlabAppPrivateKey(GitlabApp $source): ?PrivateKey
{
$privateKey = $source->privateKey;
return $privateKey?->team_id === $source->team_id ? $privateKey : null;
}
function generateGitlabCloneToken(GitlabApp $source): string
{
refreshGitlabToken($source);