Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com>
Co-authored-by: Aditya Tripathi <aditya@climactic.co>
This commit is contained in:
Andras Bacsai
2026-11-06 14:25:02 +01:00
committed by GitHub
co-authored by Claude Opus 5.5 peaklabs-dev Aditya Tripathi
parent b7dc2e435b
commit 033f0c84da
581 changed files with 58626 additions and 2456 deletions
+21 -2
View File
@@ -35,6 +35,7 @@ class GithubApp extends BaseModel
'contents',
'metadata',
'pull_requests',
'deployments',
'administration',
'organization_self_hosted_runners',
'actions',
@@ -66,7 +67,7 @@ class GithubApp extends BaseModel
*/
private ?array $installationTokenInMemory = null;
public function installationToken(): string
public function installationToken(?int $timeout = null): string
{
$credentials = implode('|', [$this->api_url, $this->app_id, $this->installation_id, $this->private_key_id]);
$cached = $this->installationTokenInMemory;
@@ -75,7 +76,7 @@ class GithubApp extends BaseModel
return $cached['token'];
}
$token = generateGithubToken($this, 'installation');
$token = generateGithubToken($this, 'installation', $timeout);
// GitHub installation tokens expire after one hour; renew them well before that.
$this->installationTokenInMemory = [
@@ -149,6 +150,24 @@ class GithubApp extends BaseModel
return $this->hasMany(GithubRunnerConfig::class);
}
/**
* Whether Coolify can create GitHub Deployments and their statuses with this App.
*/
public function canSyncDeployments(): bool
{
return ! $this->is_public && $this->missingDeploymentRequirements() === [];
}
/**
* Permissions that GitHub deployments need but the App does not have.
*
* @return array<int, string>
*/
public function missingDeploymentRequirements(): array
{
return $this->deployments === 'write' ? [] : ['Repository permission "Deployments": write'];
}
/**
* Permissions and webhook events that GitHub Actions runners need but the App does not have.
*