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

Closed PRs trigger synchronize webhooks when new PR with same branch name is created #23707

Closed
CirnoT opened this issue Mar 25, 2023 · 0 comments · Fixed by #23782
Closed

Closed PRs trigger synchronize webhooks when new PR with same branch name is created #23707

CirnoT opened this issue Mar 25, 2023 · 0 comments · Fixed by #23782
Assignees
Labels
Milestone

Comments

@CirnoT
Copy link
Contributor

CirnoT commented Mar 25, 2023

Description

PRs that were previously closed unmerged will trigger webhook of synchronize type when new PR is opened with same branch name. This is directly caused by #23189

If a user has CI integration configured, this will cause additional jobs to be spawned for each closed (but unmerged) PR that matches branch name of newly created PRs. In extreme cases this can be in hundreds. In such case, closed PRs will also inherit all status checks from new PRs, overwriting previous status checks.

Several tools such as RenovateBot reuse same branch name when creating PRs and it is not uncommon to sometimes close (aka ignore update) PRs created by Renovate.


For now, proposed fix would be to skip synchronize event on closed PRs, however this is very much a temporary band-aid and there are more code paths that might get confused by behavior change introduced by #23189.

I am not entirely sure how one could attempt to fix it. The only one possible solution I can think of would still result in PR that can not be reopened in case when source branch was force-pushed to.

Additionally, I do not believe closed PRs should be reopenable in all conditions, especially when source branch head has changed while PR was in closed state as that usually indicates that while branch name is identical, its content is very likely not applicable to closed PR and name collision is just coincidental.

Gitea Version

1.19

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?

gitea/gitea:1.19-rootless

Database

None

@jolheiser jolheiser added this to the 1.19.1 milestone Mar 26, 2023
@sillyguodong sillyguodong self-assigned this Mar 29, 2023
lunny pushed a commit that referenced this issue Mar 30, 2023
Fix #23707 
Cause by #23189
This PR is a quick fix that, when pushing commits to closed PR, webhook
and actions also be triggered.
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Mar 31, 2023
)

Fix go-gitea#23707 
Cause by go-gitea#23189
This PR is a quick fix that, when pushing commits to closed PR, webhook
and actions also be triggered.
lunny pushed a commit that referenced this issue Mar 31, 2023
…3834)

Backport #23782 by @sillyguodong

Fix #23707 
Cause by #23189
This PR is a quick fix that, when pushing commits to closed PR, webhook
and actions also be triggered.

Co-authored-by: sillyguodong <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants