Skip to content

feat(pull): improve merge box, add auto_merge to PR API - #38404

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

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

Conversation

@bircni

@bircni bircni commented Jul 10, 2026 •

Copy link
Copy Markdown
Member

Rework the pull request merge box to follow GitHub, fix auto merge edge cases, and add auto_merge to the pull request API.

  • Sections for reviews, checks, mergeability, blockers and work in progress, green when ready. Opening the merge form hides them.
  • Checks are grouped by state like GitHub, collapse once all pass, and list missing required checks.
  • The box refreshes in place while checks run, keeping the merge style and collapsed groups.
  • Auto merge can be scheduled while conflicted, and is disabled with a reason on close, WIP, retarget or a push by a non-writer. The author can cancel it.
  • Bypassing branch protection needs an explicit checkbox.
  • Command line instructions use one merge recipe for every style, so manual merges are still detected.
  • Merges follow the repository's delete branch setting, with a restore button on the timeline.
  • PullRequest API responses gain a GitHub-compatible auto_merge object.
  • /devtest/pull-merge-box shows every state.
image 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)

@silverwind

Copy link
Copy Markdown
Member

Ok I think diff is as small as it can get without dropping major functionality.

@bircni
bircni requested a review from wxiaoguang September 27, 2026 18:16
@bircni bircni added the release/highlight Marks a PR as a highlight-worthy change for the release notes. label Sep 27, 2026
@bircni bircni added this to the 28.0.0 milestone Sep 27, 2026
@silverwind

Copy link
Copy Markdown
Member

Doing a few more tweaks.

@silverwind
silverwind self-requested a review September 28, 2026 07:34
@GiteaBot GiteaBot added lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Sep 28, 2026
…the timeline

Follow GitHub's merge box more closely: checks are grouped like GitHub
with expected checks under pending, opening the merge form hides the other
sections, auto merge can be scheduled while conflicted or checking, and
work in progress shows a disabled merge button.

Use one command line merge recipe for every merge style, since the
per-style ones rewrote commits and broke manual merge detection, and show
the checkout steps to everyone again.

Web merges follow the repository's delete branch setting, and a deleted
head branch can be restored from the timeline like on GitHub.

Assisted-by: Claude Code:claude-opus-5-5
The action form is the only form in the merge section, and the section
only exists in the merge box, so the extra qualifiers were redundant.

Assisted-by: Claude Code:claude-opus-5-5
@silverwind

Copy link
Copy Markdown
Member

I think it's in a good state now, but the changes are quite a lot and more review is definitely needed.

@bircni
bircni requested a review from a team September 28, 2026 14:06
Comment thread web_src/js/features/repo-issue-pull.ts
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Sep 28, 2026
@bircni
bircni requested a review from a team September 28, 2026 17:47
@lunny
lunny requested a lite review from Copilot September 28, 2026 18:59

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

Unresolved auto-merge correctness, readiness-state, accessibility, and refresh-lifecycle issues remain.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Reworks the pull request merge box, expands auto-merge behavior, and adds auto_merge details to pull request APIs.

Changes:

  • Adds grouped checks, refreshed merge UI, merge instructions, and branch restoration.
  • Updates auto-merge scheduling, cancellation, and lifecycle handling.
  • Adds API schemas, tests, styling, localization, and devtest scenarios.
File Change
web_src/​js/​features/​repo-legacy.ts Registers merge UI initializers.
web_src/​js/​features/​repo-issue.ts Prevents duplicate WIP updates.
web_src/​js/​features/​repo-issue-pull.ts Adds merge-box refresh and menus.
web_src/​js/​components/​PullRequestMergeForm.vue Reworks merge controls.
web_src/​css/​repo/​merge-box.css Styles the redesigned merge box.
web_src/​css/​repo.css Updates status-list styling.
web_src/​css/​modules/​button.css Adds button-group styling.
web_src/​css/​index.css Imports merge-box styles.
tests/​integration/​pull_status_test.go Updates merge-status assertions.
tests/​integration/​pull_merge_test.go Tests merge, restore, and auto-merge behavior.
tests/​integration/​actions_approve_test.go Updates approval assertions.
tests/​e2e/​utils.ts Adds branch-protection setup helpers.
tests/​e2e/​pull-merge-box.test.ts Covers auto-merge and bypass flows.
templates/​swagger/​v1-swagger.generated.json Updates API schema documentation.
templates/​swagger/​v1-openapi3.generated.json Updates OpenAPI schema documentation.
templates/​repo/​pulls/​status_items.tmpl Simplifies status rendering.
templates/​repo/​issue/​view_content/​update_branch_by_merge.tmpl Adds the update-style menu.
templates/​repo/​issue/​view_content/​pull_merge_status_checks.tmpl Renders grouped checks.
templates/​repo/​issue/​view_content/​pull_merge_section.tmpl Adds reusable merge sections.
templates/​repo/​issue/​view_content/​pull_merge_instruction.tmpl Adds command-line instructions.
templates/​repo/​issue/​view_content/​pull_merge_box.tmpl Rebuilds the merge-box layout.
templates/​repo/​issue/​view_content/​comments.tmpl Adds restore and auto-merge events.
templates/​repo/​issue/​view_content.tmpl Includes merge instructions.
templates/​devtest/​pull-merge-box.tmpl Adds merge-box devtest scenarios.
services/​pull/​ref.go Includes empty pull requests in mergeability.
services/​pull/​check.go Allows conflicted auto-merge scheduling.
services/​convert/​pull.go Converts auto-merge API data.
services/​convert/​pull_test.go Tests auto-merge conversion.
services/​automerge/​notify.go Handles auto-merge lifecycle notifications.
services/​automerge/​automerge.go Updates scheduling and cancellation behavior.
services/​automerge/​automerge_test.go Tests auto-merge lifecycle scenarios.
services/​agit/​agit.go Reorders pull-request checks.
routers/​web/​web.go Requires authentication for cancellation.
routers/​web/​repo/​pull.go Updates merge handling and cancellation.
routers/​web/​repo/​pull_status_checks.go Groups and summarizes checks.
routers/​web/​repo/​pull_status_checks_test.go Tests check grouping.
routers/​web/​repo/​pull_merge_form.go Builds merge-form properties.
routers/​web/​repo/​pull_merge_box.go Builds merge-box sections and readiness.
routers/​web/​repo/​pull_merge_box_devtest.go Provides merge-box scenarios.
routers/​web/​repo/​issue_view.go Prepares merge-box state and branch restoration.
routers/​web/​devtest/​devtest.go Registers merge-box devtest data.
routers/​api/​v1/​repo/​pull.go Adds auto-merge API behavior.
options/​locale/​locale_en-US.json Adds merge-box translations.
modules/​structs/​pull.go Adds the auto-merge API structure.
models/​pull/​automerge.go Adds bulk scheduled-merge lookup.
models/​issues/​comment.go Stores auto-merge event metadata.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread services/automerge/notify.go
Comment thread web_src/js/features/repo-issue-pull.ts Outdated
Comment thread routers/web/web.go
@bircni

bircni commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

@lunny @silverwind did some cleanups - should be fine now

The mergeability check marks a pull request without a merge base as
empty, so treating empty pull requests as mergeable offered merge
buttons and auto merge that git then refuses with unrelated histories.

Assisted-by: Claude Code:claude-opus-5-5
@silverwind

Copy link
Copy Markdown
Member

Did another deep review for regressions, only 9d88adf came out of it.

@bircni

bircni commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

moved to 29.0.0 ( cc @wxiaoguang )

@bircni bircni modified the milestones: 28.0.0, 29.0.0 Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 1 This PR needs approval from one additional maintainer to be merged. release/highlight Marks a PR as a highlight-worthy change for the release notes. 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.

6 participants