Closed herrhotzenplotz closed 8 months ago
I've encountered the same problem using GitHub actions create-pull-request module in conjunction with Gitea actions. This module in order to create pull request uses mentioned in title endpoint and specifies in head
field repository name even if it creates pull request between branches of the same repository.
I have a working fix. Going to investigate if I can cover this with tests and prepare a pull request in next couple of days.
Observed
When POSTing to
/repos/{owner}/{repo}/pulls
to create a pull request with a payload which specifieshead
to be the same repository as in the request such that the source and the target repository are the same and not a fork, the REST API returns a 404 with an error messageGetForkedRepo
.e.g. in route
myuser/repo
andmyuser:some-branch
in payload.Expected
I expect this to create the pull request instead of just returning an incorrect and confusing error message.
Details
The bug seems to be that the branch in https://github.com/go-gitea/gitea/blob/main/routers/api/v1/repo/pull.go#L940-L951 does not check if it actually is the same repository and thus doesn't set
isSameRepo
to true.Versions
I saw this behaviour when runnig gitea in a FreeBSD 13.1-RELEASE jail: