Skip to content

Commit

Permalink
Merge pull request #180 from Astrotomic/dev
Browse files Browse the repository at this point in the history
fix moved repositories
  • Loading branch information
Gummibeer authored Aug 26, 2024
2 parents 956f53c + caa18d9 commit 18ca850
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()->firstOrNew([
'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 18ca850

Please sign in to comment.