mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-12 15:53:46 -04:00
v4.7 (#12478)
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:
co-authored by
Claude Opus 5.5
peaklabs-dev
Aditya Tripathi
parent
b7dc2e435b
commit
033f0c84da
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user