This commit is contained in:
Andras Bacsai
2023-06-14 11:03:54 +02:00
parent f43ca07f33
commit 767824f2f7
6 changed files with 21 additions and 10 deletions

View File

@@ -2,7 +2,7 @@
use App\Models\GithubApp;
use App\Models\GitlabApp;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Http;
use Lcobucci\JWT\Encoding\ChainedFormatter;
use Lcobucci\JWT\Encoding\JoseEncoder;
@@ -71,3 +71,10 @@ function git_api(GithubApp|GitlabApp $source, string $endpoint, string $method =
'data' => collect($json)
];
}
function get_installation_path(GithubApp $source)
{
$github = GithubApp::where('uuid', $source->uuid)->first();
$name = Str::of(Str::kebab($github->name));
$installation_path = $github->html_url === 'https://github.com' ? 'apps' : 'github-apps';
return "$github->html_url/$installation_path/$name/installations/new";
}