Skip to content

feat(pull): add bypass-rules opt-in and expose scheduled auto-merge via API - #38404

Draft
bircni wants to merge 14 commits into
go-gitea:mainfrom
bircni:feat/pull-auto-merge-bypass
Draft

feat(pull): add bypass-rules opt-in and expose scheduled auto-merge via API#38404
bircni wants to merge 14 commits into
go-gitea:mainfrom
bircni:feat/pull-auto-merge-bypass

Conversation

@bircni

@bircni bircni commented Jul 10, 2026

Copy link
Copy Markdown
Member

Reworks the pull request merge box to match GitHub's behaviour and surfaces auto-merge state on the API.

Merge box

  • Bypassing branch protection is now an explicit, red "Merge without waiting for requirements to be met (bypass rules)" checkbox above the merge button, instead of a silent, automatic force-merge for admins.
  • With unmet requirements and no bypass, the default action is now Enable auto merge — so admins (and bypass-allowlisted users) can schedule an auto-merge, not only force-merge.
  • Ticking bypass switches to an immediate merge (button turns red); the two are mutually exclusive, so force_merge and merge_when_checks_succeed are never both sent.
  • The merge-style dropdown now only selects the style and is hidden when a single style is allowed. The button and the pending-schedule notice name the style (e.g. "Enable auto merge (squash)").

API

  • PullRequest responses gain a GitHub-compatible auto_merge object (enabled_by, merge_method, commit_title, commit_message), or null when not scheduled — on both the single-PR and list endpoints (batched to avoid N+1). Swagger regenerated.

Screenshots

image

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 10, 2026
@bircni
bircni force-pushed the feat/pull-auto-merge-bypass branch from c850ce7 to bf49b39 Compare July 10, 2026 22:53
@bircni
bircni marked this pull request as ready for review July 12, 2026 11:24
@bircni
bircni requested a review from Zettat123 July 12, 2026 11:24
@github-actions github-actions Bot added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Jul 12, 2026
…bypass

# Conflicts:
#	web_src/js/components/PullRequestMergeForm.vue
@bircni
bircni requested a review from wxiaoguang July 22, 2026 15:05
@wxiaoguang

wxiaoguang commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

TBH, the checkbox UI/UX seems strange. Personally I am used to the old UI.

I prefer to keep the UI concise, avoid unnecessary interactive components when end user doesn't really need it.


That's just my opinion, just FYI. If most people like the new UI, I am neutral

@wxiaoguang

Copy link
Copy Markdown
Contributor

TBH, the checkbox UI/UX seems strange. Personally I am used to the old UI.

Or, if the "bypass" decision is not made by a checkbox, but by a secondary "toggle link/button" like "Switch to auto merge / Switch to force merge", maybe the UI would look better.

@bircni

bircni commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

Thanks @wxiaoguang for the response - i will take a look at it
Finally anyone who cares <3

@bircni

bircni commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

@wxiaoguang changed it to this:
image

@wxiaoguang

wxiaoguang commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@silverwind what do you think about the new UI?

  • If you like or are neutral: continue
  • If you don't like but wont' block: continue
  • If you would block: please suggest

@bircni

bircni commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

ping @silverwind

@bircni
bircni requested a review from a team July 31, 2026 12:47
@github-actions github-actions Bot added the topic/pr Issues related to pull requests label Jul 31, 2026
@silverwind

silverwind commented Jul 31, 2026

Copy link
Copy Markdown
Member

Looks ok but I would do something to align the button colors of the merge box with github, they only have two states, uncolored and green. Those red/blue buttons confuse me and their meaning is not really conveyed.

Whether the primary action is green or primary (blue) I don't really care but I guess for consistency it should remain blue.

@silverwind

silverwind commented Jul 31, 2026

Copy link
Copy Markdown
Member

Also I think the merge button should be last section in the box, e.g. move the command line instructions besides it, similar to GitHub:

image

@bircni

bircni commented Aug 13, 2026

Copy link
Copy Markdown
Member Author

I think we should keep the red color if you are doing something "bad" (bypass merging)

@bircni

bircni commented Aug 13, 2026

Copy link
Copy Markdown
Member Author

@silverwind @wxiaoguang ping

@wxiaoguang

Copy link
Copy Markdown
Contributor

@silverwind @wxiaoguang ping

Is silverwind happy with it now?

@bircni

bircni commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

I'd still prefer the same ui as GitHub has with the checkbox but I am also fine with this solution

@silverwind

silverwind commented Aug 19, 2026

Copy link
Copy Markdown
Member

I guess I need to take a look at this UI myself. This stray red text looks confusing. The whole merge box is full of confusing UI, I prefer a re-alignment with GitHub.

bircni added 2 commits August 29, 2026 10:18
…bypass

# Conflicts:
#	models/pull/automerge.go
#	services/convert/pull.go
@bircni

bircni commented Aug 29, 2026

Copy link
Copy Markdown
Member Author

I guess I need to take a look at this UI myself. This stray red text looks confusing. The whole merge box is full of confusing UI, I prefer a re-alignment with GitHub.

restyled it again

image

SvgIconHTML: svg.RenderHTML("octicon-dot-fill", 16, "tw-text-text-light"),
InfoHTML: info,
ListItems: util.OptionalArg(optItems),
ExtraClass: "tw-pl-6 tw-text-text-light",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is a right design.

The pullMergeBoxInfoItemCollection is designed to be a flat list. Now, you just added the hacky patches to make it "indented" and "grouped".

Image

It is very fragile.

I believe that "don't try to teach a duck to bark to make it become a dog".

If you need a new layout, design a proper data structure for it. Complex changes can be in a separate and dedicated PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems working because at the moment all callers to AddErrorItem are on infoProtectionBlockers, then the design is abused by this PR.

But indeed AddInfoItem / AddErrorItem are similar functions, the layout will break if AddInfoItem / AddErrorItem are both called for the same section.

We should avoid the unclear and fragile behaviors when designing the functions and methods. Do not bring surprises to developers.

@wxiaoguang
wxiaoguang marked this pull request as draft August 29, 2026 09:22
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. topic/pr Issues related to pull requests type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants