BaltoStar
BaltoStar

Reputation: 8987

GitHub API : create pull-request that already exists should not throw exception

GitHub API

Attempting to create a pull-request on a branch where a pull-request already exists will throw 422 Unprocessable Entity

Is it possible to instruct GitHub API to instead return success code ?

Upvotes: 3

Views: 1004

Answers (1)

VonC
VonC

Reputation: 1324935

Is it possible to instruct GitHub API to instead return success code ?

The GitHub API itself, no.
But your script could, on 422 error when creating a PR, then check if the PR exists already, and if yes, return a success code out of that PR creation function.

As the OP BaltoStar comments:

more simply just check the response error message and if matches text for PR already exists then return success code.

Upvotes: 1

Related Questions