Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty PR can be created through API #32743

Open
siccous opened this issue Dec 6, 2024 · 0 comments · May be fixed by #32742
Open

Empty PR can be created through API #32743

siccous opened this issue Dec 6, 2024 · 0 comments · May be fixed by #32742
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@siccous
Copy link

siccous commented Dec 6, 2024

Description

Using the repoCreatePullRequest API endpoint you can create a PR which does not have any commits inside.

GitHub API disallows this action:

curl -L \
  -X POST \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer xxx" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repos/xxx/xxx/pulls \
  -d '{"title":"Amazing new feature","body":"Please pull these awesome changes in!","head":"yyy:main","base":"main"}'
{
  "message": "Validation Failed",
  "errors": [
    {
      "resource": "PullRequest",
      "code": "custom",
      "message": "No commits between xxx:main and yyy:main"
    }
  ],
  "documentation_url": "https://docs.github.com/rest/pulls/pulls#create-a-pull-request",
  "status": "422"
}

My attempt to fix this is here #32742

Gitea Version

1.22.4

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

selfhosted docker image v1.22.4

Database

None

@siccous siccous linked a pull request Dec 6, 2024 that will close this issue
@yp05327 yp05327 linked a pull request Dec 9, 2024 that will close this issue
@lunny lunny added type/proposal The new feature has not been accepted yet but needs to be discussed first. and removed type/bug labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants