Skip to content

Commit

Permalink
Merge pull request #45 from geeksesi/fix/43-update-pull-request
Browse files Browse the repository at this point in the history
fix: Don't create a closed PR
  • Loading branch information
geeksesi authored Apr 10, 2023
2 parents 28efdfb + 7d20b38 commit 85001e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Services/Github/PullRequestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Exception;
use App\Models\PullRequest;
use App\Enums\Github\Repository\PullRequest\State;
use App\DTO\Github\Repository\PullRequest\PullRequestData;
use App\Http\Requests\PullRequest\StorePullRequestRequest;
use App\Actions\Github\PullRequest\FetchPullRequestInformation;
Expand All @@ -26,6 +27,10 @@ public function create(StorePullRequestRequest $request): ?PullRequest
return null;
}

if ($pullRequestData->state === State::CLOSED) {
return null;
}

return $request
->user()
?->pullRequests()
Expand Down

0 comments on commit 85001e2

Please sign in to comment.