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

Prevent creating empy PR (w/o commits) through API #32742

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

siccous
Copy link

@siccous siccous commented Dec 6, 2024

Check number of commits between head and base during PR creation, if not greater than zero return error.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 6, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Dec 6, 2024
@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code labels Dec 6, 2024
@wxiaoguang
Copy link
Contributor

Check number of commits between head and base during PR creation, if not greater than zero return error.

Well, I know some users ever requested to "allow to create empty PR" because they need an empty PR to start their work (different teams have different workflows)

So, I guess it won't hurt without such check? 🤔

@siccous
Copy link
Author

siccous commented Dec 6, 2024

Understand, it hits me because it is different from GitHub API behaviour.

Details in my issue #32743.

@wxiaoguang
Copy link
Contributor

Understand, it hits me because it is different from GitHub API behaviour.

A lot of Gitea's behaviors are different from GitHub, actually there is no compatibility guaranteed, Gitea is an independent project.

And you see, the CI tests fail 😅

@wxiaoguang wxiaoguang marked this pull request as draft December 7, 2024 03:24
@lunny
Copy link
Member

lunny commented Dec 7, 2024

It's useful to create an empty pull request especially for #31899

@yp05327
Copy link
Contributor

yp05327 commented Dec 9, 2024

Actually, IMO it is a feature in Gitea which is different from GitHub.
And you can also create empty PR from Web UI. So the behavior should be same between them at least.

@yp05327 yp05327 linked an issue Dec 9, 2024 that may be closed by this pull request
@siccous
Copy link
Author

siccous commented Dec 9, 2024

Okey, is there any interest to make it configurable as an argument in the create PR API call? If not, then feel free to close this PR.

Thank you all.

@wxiaoguang
Copy link
Contributor

is there any interest to make it configurable as an argument in the create PR API call?

I think it is feasible if there are tests to cover it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty PR can be created through API
5 participants