Skip to content

Commit

Permalink
fix moved repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
Gummibeer committed Aug 26, 2024
1 parent 57dde3c commit a2bf630
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/Models/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static function fromGithub(array $data): ?self
}

try {
return $owner->repositories()->withBlocked()->firstOrCreate([
$repository = self::query()->withBlocked()->firstOrCreate([
'id' => $data['id'],
], [
'name' => $data['full_name'],
Expand All @@ -123,6 +123,10 @@ public static function fromGithub(array $data): ?self
'stargazers_count' => $data['stargazers_count'],
'website' => $data['homepage'],
]);
$repository->owner()->associate($owner);
$repository->save();

return $repository;
} catch (Throwable $ex) {
if (
$ex instanceof BadMethodCallException
Expand Down

0 comments on commit a2bf630

Please sign in to comment.