#add git monitor
This commit is contained in:
28
app/Console/Commands/GitMonitorCacheCommand.php
Normal file
28
app/Console/Commands/GitMonitorCacheCommand.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Services\GitMonitorService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class GitMonitorCacheCommand extends Command
|
||||
{
|
||||
protected $signature = 'git-monitor:cache';
|
||||
|
||||
protected $description = '刷新 release 版本缓存,保存到 configs 表';
|
||||
|
||||
public function handle(GitMonitorService $monitor): void
|
||||
{
|
||||
$cache = $monitor->refreshReleaseCache(true);
|
||||
|
||||
if (empty($cache)) {
|
||||
$this->warn('未获取到任何 release 版本信息,请检查配置。');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->info(sprintf(
|
||||
'已缓存 %d 个仓库的 release 分支信息。',
|
||||
count($cache['repositories'] ?? [])
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user