Update app/Console/Commands/SyncBunny.php
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
2768805996
commit
24bcce3f9b
1 changed files with 19 additions and 1 deletions
|
|
@ -82,8 +82,26 @@ private function syncReleasesToGitHubRepo(): bool
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->info('Checking for changes...');
|
||||||
|
$statusOutput = [];
|
||||||
|
exec('cd '.escapeshellarg($tmpDir).' && git status --porcelain json/releases.json 2>&1', $statusOutput, $returnCode);
|
||||||
|
if ($returnCode !== 0) {
|
||||||
|
$this->error('Failed to check repository status: '.implode("\n", $statusOutput));
|
||||||
|
exec('rm -rf '.escapeshellarg($tmpDir));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty(array_filter($statusOutput))) {
|
||||||
|
$this->info('Releases are already up to date. No changes to commit.');
|
||||||
|
exec('rm -rf '.escapeshellarg($tmpDir));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$commitMessage = 'Update releases.json with latest releases - '.date('Y-m-d H:i:s');
|
$commitMessage = 'Update releases.json with latest releases - '.date('Y-m-d H:i:s');
|
||||||
exec("cd $tmpDir && git commit -m '$commitMessage' 2>&1", $output, $returnCode);
|
$output = [];
|
||||||
|
exec('cd '.escapeshellarg($tmpDir).' && git commit -m '.escapeshellarg($commitMessage).' 2>&1', $output, $returnCode);
|
||||||
if ($returnCode !== 0) {
|
if ($returnCode !== 0) {
|
||||||
$this->error('Failed to commit changes: '.implode("\n", $output));
|
$this->error('Failed to commit changes: '.implode("\n", $output));
|
||||||
exec("rm -rf $tmpDir");
|
exec("rm -rf $tmpDir");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue