chore: use new functions

This commit is contained in:
peaklabs-dev
2025-01-06 16:27:47 +01:00
committed by 🏔️ Peak
parent 4d34d689b0
commit 2c4bdb76bd
7 changed files with 10 additions and 10 deletions

View File

@@ -27,7 +27,7 @@ class GithubAppPermissionJob implements ShouldBeEncrypted, ShouldQueue
public function handle() public function handle()
{ {
try { try {
$github_access_token = generate_github_jwt_token($this->github_app); $github_access_token = generateGithubJwt($this->github_app);
$response = Http::withHeaders([ $response = Http::withHeaders([
'Authorization' => "Bearer $github_access_token", 'Authorization' => "Bearer $github_access_token",
'Accept' => 'application/vnd.github+json', 'Accept' => 'application/vnd.github+json',

View File

@@ -105,7 +105,7 @@ class GithubPrivateRepository extends Component
$this->page = 1; $this->page = 1;
$this->selected_github_app_id = $github_app_id; $this->selected_github_app_id = $github_app_id;
$this->github_app = GithubApp::where('id', $github_app_id)->first(); $this->github_app = GithubApp::where('id', $github_app_id)->first();
$this->token = generate_github_installation_token($this->github_app); $this->token = generateGithubInstallationToken($this->github_app);
$this->loadRepositoryByPage(); $this->loadRepositoryByPage();
if ($this->repositories->count() < $this->total_repositories_count) { if ($this->repositories->count() < $this->total_repositories_count) {
while ($this->repositories->count() < $this->total_repositories_count) { while ($this->repositories->count() < $this->total_repositories_count) {

View File

@@ -76,7 +76,7 @@ class Change extends Component
// Need administration:read:write permission // Need administration:read:write permission
// https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-a-repository // https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-a-repository
// $github_access_token = generate_github_installation_token($this->github_app); // $github_access_token = generateGithubInstallationToken($this->github_app);
// $repositories = Http::withToken($github_access_token)->get("{$this->github_app->api_url}/installation/repositories?per_page=100"); // $repositories = Http::withToken($github_access_token)->get("{$this->github_app->api_url}/installation/repositories?per_page=100");
// $runners_by_repository = collect([]); // $runners_by_repository = collect([]);
// $repositories = $repositories->json()['repositories']; // $repositories = $repositories->json()['repositories'];

View File

@@ -999,7 +999,7 @@ class Application extends BaseModel
$fullRepoUrl = "{$this->source->html_url}/{$customRepository}"; $fullRepoUrl = "{$this->source->html_url}/{$customRepository}";
$base_command = "{$base_command} {$this->source->html_url}/{$customRepository}"; $base_command = "{$base_command} {$this->source->html_url}/{$customRepository}";
} else { } else {
$github_access_token = generate_github_installation_token($this->source); $github_access_token = generateGithubInstallationToken($this->source);
if ($exec_in_docker) { if ($exec_in_docker) {
$base_command = "{$base_command} $source_html_url_scheme://x-access-token:$github_access_token@$source_html_url_host/{$customRepository}.git"; $base_command = "{$base_command} $source_html_url_scheme://x-access-token:$github_access_token@$source_html_url_host/{$customRepository}.git";
@@ -1111,7 +1111,7 @@ class Application extends BaseModel
$commands->push($git_clone_command); $commands->push($git_clone_command);
} }
} else { } else {
$github_access_token = generate_github_installation_token($this->source); $github_access_token = generateGithubInstallationToken($this->source);
if ($exec_in_docker) { if ($exec_in_docker) {
$git_clone_command = "{$git_clone_command} $source_html_url_scheme://x-access-token:$github_access_token@$source_html_url_host/{$customRepository}.git {$baseDir}"; $git_clone_command = "{$git_clone_command} $source_html_url_scheme://x-access-token:$github_access_token@$source_html_url_host/{$customRepository}.git {$baseDir}";
$fullRepoUrl = "$source_html_url_scheme://x-access-token:$github_access_token@$source_html_url_host/{$customRepository}.git"; $fullRepoUrl = "$source_html_url_scheme://x-access-token:$github_access_token@$source_html_url_host/{$customRepository}.git";

View File

@@ -10,7 +10,7 @@
</x-forms.button> </x-forms.button>
</a> </a>
@if (data_get($application, 'source.is_public') === false) @if (data_get($application, 'source.is_public') === false)
<a target="_blank" class="hover:no-underline" href="{{ get_installation_path($application->source) }}"> <a target="_blank" class="hover:no-underline" href="{{ getInstallationPath($application->source) }}">
<x-forms.button> <x-forms.button>
Open Git App Open Git App
<x-external-link /> <x-external-link />

View File

@@ -5,7 +5,7 @@
<livewire:source.github.create /> <livewire:source.github.create />
</x-modal-input> </x-modal-input>
@if ($repositories->count() > 0) @if ($repositories->count() > 0)
<a target="_blank" class="flex hover:no-underline" href="{{ get_installation_path($github_app) }}"> <a target="_blank" class="flex hover:no-underline" href="{{ getInstallationPath($github_app) }}">
<x-forms.button> <x-forms.button>
Change Repositories on GitHub Change Repositories on GitHub
<x-external-link /> <x-external-link />

View File

@@ -6,7 +6,7 @@
<div class="flex gap-2"> <div class="flex gap-2">
@if (data_get($github_app, 'installation_id')) @if (data_get($github_app, 'installation_id'))
<x-forms.button type="submit">Save</x-forms.button> <x-forms.button type="submit">Save</x-forms.button>
<a href="{{ get_installation_path($github_app) }}"> <a href="{{ getInstallationPath($github_app) }}">
<x-forms.button> <x-forms.button>
Update Repositories Update Repositories
<x-external-link /> <x-external-link />
@@ -52,7 +52,7 @@
</svg> </svg>
<span>You must complete this step before you can use this source!</span> <span>You must complete this step before you can use this source!</span>
</div> </div>
<a class="items-center justify-center box" href="{{ get_installation_path($github_app) }}"> <a class="items-center justify-center box" href="{{ getInstallationPath($github_app) }}">
Install Repositories on GitHub Install Repositories on GitHub
</a> </a>
@else @else
@@ -106,7 +106,7 @@
<div class="flex items-end gap-2 "> <div class="flex items-end gap-2 ">
<h2 class="pt-4">Permissions</h2> <h2 class="pt-4">Permissions</h2>
<x-forms.button wire:click.prevent="checkPermissions">Refetch</x-forms.button> <x-forms.button wire:click.prevent="checkPermissions">Refetch</x-forms.button>
<a href="{{ get_permissions_path($github_app) }}"> <a href="{{ getPermissionsPath($github_app) }}">
<x-forms.button> <x-forms.button>
Update Update
<x-external-link /> <x-external-link />