mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
Implement end-to-end GitHub Actions runner support with provisioning, tracking, and cleanup flows. - handle `workflow_job` webhooks to provision and tear down runners - add runner config/execution models, enum states, and relationships - create jobs for provisioning, cleanup, and stale-runner reaping - schedule periodic stale runner cleanup in the console kernel - add Livewire server UI to manage runner configuration and executions - store GitHub App runner permissions and runner group metadata - add migrations for runner permissions, configs, executions, and group id - update GitHub permissions URL generation for organization app settings - include feature/unit tests for runner behavior and permission paths
49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\GithubRunnerStatus;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class GithubRunnerExecution extends BaseModel
|
|
{
|
|
protected $guarded = [];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'status' => GithubRunnerStatus::class,
|
|
'workflow_job_id' => 'integer',
|
|
'runner_id' => 'integer',
|
|
'pid' => 'integer',
|
|
'started_at' => 'datetime',
|
|
'completed_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function server(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Server::class);
|
|
}
|
|
|
|
public function config(): BelongsTo
|
|
{
|
|
return $this->belongsTo(GithubRunnerConfig::class, 'github_runner_config_id');
|
|
}
|
|
|
|
public function isActive(): bool
|
|
{
|
|
return $this->status->isActive();
|
|
}
|
|
|
|
public function duration(): ?string
|
|
{
|
|
if (! $this->started_at) {
|
|
return null;
|
|
}
|
|
|
|
$end = $this->completed_at ?? now();
|
|
|
|
return $this->started_at->diffForHumans($end, true);
|
|
}
|
|
}
|