Laravel 13 + Filament 5 admin panel and REST API for a non-profit developer collective, backed by the Pireon OAuth identity server. The public site is a separate, server-rendered application consuming /api/public/v1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Health\Checks;
|
|
|
|
use App\Filament\Resources\Repositories\RepositoryResource;
|
|
use App\Models\Repository;
|
|
use App\Support\Health\Check;
|
|
use App\Support\Health\Finding;
|
|
|
|
/**
|
|
* Repositories whose sync keeps failing.
|
|
*
|
|
* Usually a repository that was renamed, made private or deleted. The public
|
|
* site keeps showing the last numbers it managed to fetch, which is worse than
|
|
* showing none: the whole reason for syncing is that live figures are trusted
|
|
* in a way hand-written ones are not.
|
|
*/
|
|
class StaleRepositories implements Check
|
|
{
|
|
public function key(): string
|
|
{
|
|
return 'stale-repositories';
|
|
}
|
|
|
|
public function permission(): ?string
|
|
{
|
|
return 'repositories.view_any';
|
|
}
|
|
|
|
public function run(): Finding
|
|
{
|
|
$failing = Repository::query()->failing()->get(['id', 'full_name']);
|
|
|
|
return Finding::problem(
|
|
$this->key(),
|
|
$failing->count(),
|
|
url: RepositoryResource::getUrl('index'),
|
|
samples: $failing->pluck('full_name')->all(),
|
|
);
|
|
}
|
|
}
|