2023-05-03 21:52:19 +08:00
|
|
|
{{if and .Issue.PullRequest.HasMerged (not .IsPullBranchDeletable)}}
|
|
|
|
|
{{/* Then the merge box will not be displayed because this page already contains enough information */}}
|
|
|
|
|
{{else}}
|
2025-04-24 21:26:57 +02:00
|
|
|
<div class="timeline-item comment pull-merge-box"
|
|
|
|
|
data-global-init="initRepoPullMergeBox"
|
|
|
|
|
{{if .PullMergeBoxReloadingInterval}}
|
|
|
|
|
data-pull-merge-box-reloading-interval="{{.PullMergeBoxReloadingInterval}}"
|
|
|
|
|
data-pull-link="{{.Issue.Link}}"
|
|
|
|
|
{{end}}
|
|
|
|
|
>
|
2026-01-15 09:25:14 +11:00
|
|
|
{{$statusCheckData := .StatusCheckData}}
|
|
|
|
|
{{$requiredStatusCheckState := $statusCheckData.RequiredChecksState}}
|
2026-02-22 23:56:33 +01:00
|
|
|
<div class="timeline-avatar {{if .Issue.PullRequest.HasMerged}}tw-text-purple
|
|
|
|
|
{{- else if .Issue.IsClosed}}tw-text-text-light
|
|
|
|
|
{{- else if .IsPullWorkInProgress}}tw-text-text-light
|
|
|
|
|
{{- else if .IsFilesConflicted}}tw-text-text-light
|
|
|
|
|
{{- else if .IsPullRequestBroken}}tw-text-red
|
|
|
|
|
{{- else if .IsBlockedByApprovals}}tw-text-red
|
|
|
|
|
{{- else if .IsBlockedByRejection}}tw-text-red
|
|
|
|
|
{{- else if .IsBlockedByOfficialReviewRequests}}tw-text-red
|
|
|
|
|
{{- else if .IsBlockedByOutdatedBranch}}tw-text-red
|
|
|
|
|
{{- else if .IsBlockedByChangedProtectedFiles}}tw-text-red
|
|
|
|
|
{{- else if and .EnableStatusCheck (or $requiredStatusCheckState.IsFailure $requiredStatusCheckState.IsError)}}tw-text-red
|
|
|
|
|
{{- else if and .EnableStatusCheck (or (not $.LatestCommitStatus) $requiredStatusCheckState.IsPending $requiredStatusCheckState.IsWarning)}}tw-text-yellow
|
|
|
|
|
{{- else if and .AllowMerge .RequireSigned (not .WillSign)}}tw-text-red
|
|
|
|
|
{{- else if .Issue.PullRequest.IsChecking}}tw-text-yellow
|
|
|
|
|
{{- else if .Issue.PullRequest.IsEmpty}}tw-text-text-light
|
|
|
|
|
{{- else if .Issue.PullRequest.CanAutoMerge}}tw-text-green
|
|
|
|
|
{{- else}}tw-text-red{{end}}">{{svg "octicon-git-merge" 40}}</div>
|
2017-03-17 06:57:43 +01:00
|
|
|
<div class="content">
|
2024-04-24 03:24:10 +08:00
|
|
|
{{if .LatestCommitStatus}}
|
2023-11-02 23:49:02 +09:00
|
|
|
<div class="ui attached segment fitted">
|
|
|
|
|
{{template "repo/pulls/status" (dict
|
|
|
|
|
"CommitStatus" .LatestCommitStatus
|
|
|
|
|
"CommitStatuses" .LatestCommitStatuses
|
|
|
|
|
"ShowHideChecks" true
|
2026-01-15 09:25:14 +11:00
|
|
|
"StatusCheckData" $statusCheckData
|
2023-11-02 23:49:02 +09:00
|
|
|
)}}
|
|
|
|
|
</div>
|
2024-04-24 03:24:10 +08:00
|
|
|
{{end}}
|
2023-02-21 18:03:41 +08:00
|
|
|
{{$showGeneralMergeForm := false}}
|
2025-07-13 22:52:35 +08:00
|
|
|
<div class="ui attached segment merge-section {{if not $.LatestCommitStatus}}avatar-content-left-arrow{{end}} flex-items-block">
|
2017-03-17 06:57:43 +01:00
|
|
|
{{if .Issue.PullRequest.HasMerged}}
|
2023-05-03 21:52:19 +08:00
|
|
|
{{if .IsPullBranchDeletable}}
|
2024-03-22 14:45:10 +01:00
|
|
|
<div class="item item-section text tw-flex-1">
|
2023-05-03 21:52:19 +08:00
|
|
|
<div class="item-section-left">
|
2024-03-24 17:42:49 +01:00
|
|
|
<h3 class="tw-mb-2">
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.merged_success"}}
|
2023-05-03 21:52:19 +08:00
|
|
|
</h3>
|
|
|
|
|
<div class="merge-section-info">
|
2024-02-25 18:45:56 +08:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.merged_info_text" (HTMLFormat "<code>%s</code>" .HeadTarget)}}
|
2023-05-03 21:52:19 +08:00
|
|
|
</div>
|
2023-04-23 20:12:36 +02:00
|
|
|
</div>
|
|
|
|
|
<div class="item-section-right">
|
2025-10-21 22:06:56 -07:00
|
|
|
<button class="ui button link-action delete-branch-after-merge" data-url="{{.DeleteBranchLink}}">{{ctx.Locale.Tr "repo.branch.delete_html"}}</button>
|
2023-04-23 20:12:36 +02:00
|
|
|
</div>
|
2023-05-03 21:52:19 +08:00
|
|
|
</div>
|
|
|
|
|
{{end}}
|
2017-03-17 06:57:43 +01:00
|
|
|
{{else if .Issue.IsClosed}}
|
2024-03-22 14:45:10 +01:00
|
|
|
<div class="item item-section text tw-flex-1">
|
2023-04-23 20:12:36 +02:00
|
|
|
<div class="item-section-left">
|
2024-03-24 17:42:49 +01:00
|
|
|
<h3 class="tw-mb-2">{{ctx.Locale.Tr "repo.pulls.closed"}}</h3>
|
2023-04-23 20:12:36 +02:00
|
|
|
<div class="merge-section-info">
|
|
|
|
|
{{if .IsPullRequestBroken}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.cant_reopen_deleted_branch"}}
|
2023-04-23 20:12:36 +02:00
|
|
|
{{else}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.reopen_to_merge"}}
|
2023-04-23 20:12:36 +02:00
|
|
|
{{end}}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{{if and .IsPullBranchDeletable (not .IsPullRequestBroken)}}
|
|
|
|
|
<div class="item-section-right">
|
2025-10-21 22:06:56 -07:00
|
|
|
<button class="ui button link-action delete-branch-after-merge" data-url="{{.DeleteBranchLink}}">{{ctx.Locale.Tr "repo.branch.delete_html"}}</button>
|
2023-04-23 20:12:36 +02:00
|
|
|
</div>
|
2019-04-20 22:50:34 +02:00
|
|
|
{{end}}
|
2017-03-17 06:57:43 +01:00
|
|
|
</div>
|
2019-02-05 19:54:49 +08:00
|
|
|
{{else if .IsPullFilesConflicted}}
|
2023-06-15 00:40:15 +08:00
|
|
|
<div class="item">
|
2020-09-11 22:19:00 +02:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.files_conflicted"}}
|
2019-02-05 19:54:49 +08:00
|
|
|
</div>
|
2023-06-15 00:40:15 +08:00
|
|
|
<ul>
|
|
|
|
|
{{range .ConflictedFiles}}
|
|
|
|
|
<li>{{.}}</li>
|
2026-01-27 11:57:20 -08:00
|
|
|
{{else}}
|
|
|
|
|
<li>{{ctx.Locale.Tr "repo.pulls.files_conflicted_no_listed_files"}}</li>
|
2023-06-15 00:40:15 +08:00
|
|
|
{{end}}
|
|
|
|
|
</ul>
|
2018-08-01 05:00:35 +02:00
|
|
|
{{else if .IsPullRequestBroken}}
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.data_broken"}}
|
2017-03-17 06:57:43 +01:00
|
|
|
</div>
|
2018-08-13 21:04:39 +02:00
|
|
|
{{else if .IsPullWorkInProgress}}
|
2025-03-05 01:58:17 +08:00
|
|
|
<div class="item">
|
2024-03-22 14:45:10 +01:00
|
|
|
<div class="item-section-left flex-text-inline tw-flex-1">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.cannot_merge_work_in_progress"}}
|
2021-05-27 22:02:04 +02:00
|
|
|
</div>
|
2023-06-15 00:40:15 +08:00
|
|
|
{{if or .HasIssuesOrPullsWritePermission .IsIssuePoster}}
|
2025-07-01 16:32:39 +08:00
|
|
|
<button class="ui compact button" data-global-init="initPullRequestWipToggle" data-title="{{.Issue.Title}}" data-wip-prefix="{{.WorkInProgressPrefix}}" data-update-url="{{.Issue.Link}}/title">
|
2024-02-25 22:02:20 +08:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.remove_prefix" .WorkInProgressPrefix}}
|
2023-06-15 00:40:15 +08:00
|
|
|
</button>
|
|
|
|
|
{{end}}
|
2018-08-13 21:04:39 +02:00
|
|
|
</div>
|
2023-03-31 01:00:49 +08:00
|
|
|
{{template "repo/issue/view_content/update_branch_by_merge" $}}
|
2017-03-17 06:57:43 +01:00
|
|
|
{{else if .Issue.PullRequest.IsChecking}}
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2025-11-02 16:30:13 +08:00
|
|
|
{{svg "gitea-running" 16 "rotate-clockwise"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.is_checking"}}
|
2017-03-17 06:57:43 +01:00
|
|
|
</div>
|
2022-07-13 10:22:51 +02:00
|
|
|
{{else if .Issue.PullRequest.IsAncestor}}
|
2021-05-27 22:02:04 +02:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-alert"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.is_ancestor"}}
|
2021-03-04 11:41:23 +08:00
|
|
|
</div>
|
2022-07-13 10:22:51 +02:00
|
|
|
{{else if or .Issue.PullRequest.CanAutoMerge .Issue.PullRequest.IsEmpty}}
|
2020-01-11 08:29:34 +01:00
|
|
|
{{if .IsBlockedByApprovals}}
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-x"}}
|
2024-09-06 01:40:02 -05:00
|
|
|
{{if .RequireApprovalsWhitelist}}
|
|
|
|
|
{{ctx.Locale.Tr "repo.pulls.blocked_by_approvals_whitelisted" .GrantedApprovals .ProtectedBranch.RequiredApprovals}}
|
|
|
|
|
{{else}}
|
|
|
|
|
{{ctx.Locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .ProtectedBranch.RequiredApprovals}}
|
|
|
|
|
{{end}}
|
2020-01-11 08:29:34 +01:00
|
|
|
</div>
|
|
|
|
|
{{else if .IsBlockedByRejection}}
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.blocked_by_rejection"}}
|
2020-01-11 08:29:34 +01:00
|
|
|
</div>
|
2020-11-29 03:30:46 +08:00
|
|
|
{{else if .IsBlockedByOfficialReviewRequests}}
|
|
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.blocked_by_official_review_requests"}}
|
2020-11-29 03:30:46 +08:00
|
|
|
</div>
|
2020-04-17 03:00:36 +02:00
|
|
|
{{else if .IsBlockedByOutdatedBranch}}
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.blocked_by_outdated_branch"}}
|
2020-04-17 03:00:36 +02:00
|
|
|
</div>
|
2020-10-14 02:50:57 +08:00
|
|
|
{{else if .IsBlockedByChangedProtectedFiles}}
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-x"}}
|
2024-02-23 01:02:33 +08:00
|
|
|
{{ctx.Locale.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n"}}
|
2020-10-14 02:50:57 +08:00
|
|
|
</div>
|
2023-06-15 00:40:15 +08:00
|
|
|
<ul>
|
|
|
|
|
{{range .ChangedProtectedFiles}}
|
|
|
|
|
<li>{{.}}</li>
|
|
|
|
|
{{end}}
|
|
|
|
|
</ul>
|
2026-01-15 09:25:14 +11:00
|
|
|
{{else if and .EnableStatusCheck (or $requiredStatusCheckState.IsError $requiredStatusCheckState.IsFailure)}}
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.required_status_check_failed"}}
|
2020-01-11 08:29:34 +01:00
|
|
|
</div>
|
2026-01-15 09:25:14 +11:00
|
|
|
{{else if and .EnableStatusCheck (not $requiredStatusCheckState.IsSuccess)}}
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.required_status_check_missing"}}
|
2020-04-15 22:35:18 +02:00
|
|
|
</div>
|
2020-08-23 22:59:41 +01:00
|
|
|
{{else if and .AllowMerge .RequireSigned (not .WillSign)}}
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.require_signed_wont_sign"}}
|
2020-01-15 08:32:57 +00:00
|
|
|
</div>
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-unlock"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason)}}
|
2020-01-15 08:32:57 +00:00
|
|
|
</div>
|
2019-09-18 13:39:45 +08:00
|
|
|
{{end}}
|
2022-06-11 16:44:20 +02:00
|
|
|
|
2026-01-15 09:25:14 +11:00
|
|
|
{{$notAllOverridableChecksOk := or .IsBlockedByApprovals .IsBlockedByRejection .IsBlockedByOfficialReviewRequests .IsBlockedByOutdatedBranch .IsBlockedByChangedProtectedFiles (and .EnableStatusCheck (not $requiredStatusCheckState.IsSuccess))}}
|
2022-06-11 16:44:20 +02:00
|
|
|
|
2022-07-12 17:32:37 -04:00
|
|
|
{{/* admin can merge without checks, writer can merge when checks succeed */}}
|
2024-10-23 06:39:43 +02:00
|
|
|
{{$canMergeNow := and (or (and (not $.ProtectedBranch.BlockAdminMergeOverride) $.IsRepoAdmin) (not $notAllOverridableChecksOk)) (or (not .AllowMerge) (not .RequireSigned) .WillSign)}}
|
2022-06-11 16:44:20 +02:00
|
|
|
{{/* admin and writer both can make an auto merge schedule */}}
|
|
|
|
|
|
|
|
|
|
{{if $canMergeNow}}
|
2020-01-16 22:01:22 +01:00
|
|
|
{{if $notAllOverridableChecksOk}}
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-dot-fill"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.required_status_check_administrator"}}
|
2018-12-27 11:27:08 +01:00
|
|
|
</div>
|
2019-09-18 13:39:45 +08:00
|
|
|
{{else}}
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-check"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.can_auto_merge_desc"}}
|
2018-01-05 20:56:50 +02:00
|
|
|
</div>
|
2019-09-18 13:39:45 +08:00
|
|
|
{{end}}
|
2020-01-15 08:32:57 +00:00
|
|
|
{{if .WillSign}}
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2026-02-22 23:56:33 +01:00
|
|
|
{{svg "octicon-lock" 16 "tw-text-green"}}
|
2025-09-12 05:00:18 +02:00
|
|
|
{{ctx.Locale.Tr "repo.signing.will_sign" .SigningKeyMergeDisplay}}
|
2020-01-15 08:32:57 +00:00
|
|
|
</div>
|
2020-01-15 23:55:25 +01:00
|
|
|
{{else if .IsSigned}}
|
2020-11-15 21:58:16 +01:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-unlock"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason)}}
|
2020-01-15 08:32:57 +00:00
|
|
|
</div>
|
|
|
|
|
{{end}}
|
2020-06-14 02:49:59 +08:00
|
|
|
{{end}}
|
2025-04-24 21:26:57 +02:00
|
|
|
|
2023-03-31 01:00:49 +08:00
|
|
|
{{template "repo/issue/view_content/update_branch_by_merge" $}}
|
2025-04-24 21:26:57 +02:00
|
|
|
|
2022-07-13 10:22:51 +02:00
|
|
|
{{if .Issue.PullRequest.IsEmpty}}
|
2023-06-29 14:24:22 +02:00
|
|
|
<div class="divider"></div>
|
2022-07-13 10:22:51 +02:00
|
|
|
<div class="item">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-alert"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.is_empty"}}
|
2022-07-13 10:22:51 +02:00
|
|
|
</div>
|
|
|
|
|
{{end}}
|
2020-06-14 02:49:59 +08:00
|
|
|
|
2022-06-11 16:44:20 +02:00
|
|
|
{{if .AllowMerge}} {{/* user is allowed to merge */}}
|
2024-11-05 14:04:26 +08:00
|
|
|
{{$prUnit := .Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypePullRequests}}
|
2024-02-12 14:37:23 -08:00
|
|
|
{{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash $prUnit.PullRequestsConfig.AllowFastForwardOnly}}
|
2022-06-11 16:44:20 +02:00
|
|
|
{{$hasPendingPullRequestMergeTip := ""}}
|
|
|
|
|
{{if .HasPendingPullRequestMerge}}
|
2024-11-04 19:30:00 +08:00
|
|
|
{{$createdPRMergeStr := DateUtils.TimeSince .PendingPullRequestMerge.CreatedUnix}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{$hasPendingPullRequestMergeTip = ctx.Locale.Tr "repo.pulls.auto_merge_has_pending_schedule" .PendingPullRequestMerge.Doer.Name $createdPRMergeStr}}
|
2022-06-11 16:44:20 +02:00
|
|
|
{{end}}
|
2023-06-29 14:24:22 +02:00
|
|
|
<div class="divider"></div>
|
2023-02-10 00:31:30 +08:00
|
|
|
<script type="module">
|
2026-04-03 10:25:45 +08:00
|
|
|
(() => {
|
2023-02-10 00:31:30 +08:00
|
|
|
const defaultMergeTitle = {{.DefaultMergeMessage}};
|
|
|
|
|
const defaultSquashMergeTitle = {{.DefaultSquashMergeMessage}};
|
2024-06-06 10:35:04 +02:00
|
|
|
const defaultMergeMessage = {{.DefaultMergeBody}};
|
|
|
|
|
const defaultSquashMergeMessage = {{.DefaultSquashMergeBody}};
|
2023-02-10 00:31:30 +08:00
|
|
|
const mergeForm = {
|
2025-04-24 21:26:57 +02:00
|
|
|
'baseLink': {{.Issue.Link}},
|
2023-09-25 10:56:50 +02:00
|
|
|
'textCancel': {{ctx.Locale.Tr "cancel"}},
|
|
|
|
|
'textDeleteBranch': {{ctx.Locale.Tr "repo.branch.delete" .HeadTarget}},
|
|
|
|
|
'textAutoMergeButtonWhenSucceed': {{ctx.Locale.Tr "repo.pulls.auto_merge_button_when_succeed"}},
|
|
|
|
|
'textAutoMergeWhenSucceed': {{ctx.Locale.Tr "repo.pulls.auto_merge_when_succeed"}},
|
|
|
|
|
'textAutoMergeCancelSchedule': {{ctx.Locale.Tr "repo.pulls.auto_merge_cancel_schedule"}},
|
|
|
|
|
'textClearMergeMessage': {{ctx.Locale.Tr "repo.pulls.clear_merge_message"}},
|
|
|
|
|
'textClearMergeMessageHint': {{ctx.Locale.Tr "repo.pulls.clear_merge_message_hint"}},
|
|
|
|
|
'textMergeCommitId': {{ctx.Locale.Tr "repo.pulls.merge_commit_id"}},
|
2022-05-12 21:39:02 +08:00
|
|
|
|
2023-02-10 00:31:30 +08:00
|
|
|
'canMergeNow': {{$canMergeNow}},
|
|
|
|
|
'allOverridableChecksOk': {{not $notAllOverridableChecksOk}},
|
|
|
|
|
'emptyCommit': {{.Issue.PullRequest.IsEmpty}},
|
|
|
|
|
'pullHeadCommitID': {{.PullHeadCommitID}},
|
|
|
|
|
'isPullBranchDeletable': {{.IsPullBranchDeletable}},
|
|
|
|
|
'defaultMergeStyle': {{.MergeStyle}},
|
|
|
|
|
'defaultDeleteBranchAfterMerge': {{$prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge}},
|
2023-09-25 10:56:50 +02:00
|
|
|
'mergeMessageFieldPlaceHolder': {{ctx.Locale.Tr "repo.editor.commit_message_desc"}},
|
2023-02-10 00:31:30 +08:00
|
|
|
'defaultMergeMessage': defaultMergeMessage,
|
2022-05-12 21:39:02 +08:00
|
|
|
|
2023-02-10 00:31:30 +08:00
|
|
|
'hasPendingPullRequestMerge': {{.HasPendingPullRequestMerge}},
|
|
|
|
|
'hasPendingPullRequestMergeTip': {{$hasPendingPullRequestMergeTip}},
|
|
|
|
|
};
|
2022-05-12 21:39:02 +08:00
|
|
|
|
2023-02-13 17:59:59 +00:00
|
|
|
const generalHideAutoMerge = mergeForm.canMergeNow && mergeForm.allOverridableChecksOk; // if this pr can be merged now, then hide the auto merge
|
2023-02-10 00:31:30 +08:00
|
|
|
mergeForm['mergeStyles'] = [
|
|
|
|
|
{
|
|
|
|
|
'name': 'merge',
|
|
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowMerge}},
|
2023-09-25 10:56:50 +02:00
|
|
|
'textDoMerge': {{ctx.Locale.Tr "repo.pulls.merge_pull_request"}},
|
2023-02-10 00:31:30 +08:00
|
|
|
'mergeTitleFieldText': defaultMergeTitle,
|
|
|
|
|
'mergeMessageFieldText': defaultMergeMessage,
|
|
|
|
|
'hideAutoMerge': generalHideAutoMerge,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'name': 'rebase',
|
|
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowRebase}},
|
2023-09-25 10:56:50 +02:00
|
|
|
'textDoMerge': {{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}},
|
2023-02-10 00:31:30 +08:00
|
|
|
'hideMergeMessageTexts': true,
|
|
|
|
|
'hideAutoMerge': generalHideAutoMerge,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'name': 'rebase-merge',
|
|
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowRebaseMerge}},
|
2023-09-25 10:56:50 +02:00
|
|
|
'textDoMerge': {{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}},
|
2023-02-10 00:31:30 +08:00
|
|
|
'mergeTitleFieldText': defaultMergeTitle,
|
|
|
|
|
'mergeMessageFieldText': defaultMergeMessage,
|
|
|
|
|
'hideAutoMerge': generalHideAutoMerge,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'name': 'squash',
|
|
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowSquash}},
|
2023-09-25 10:56:50 +02:00
|
|
|
'textDoMerge': {{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}},
|
2023-02-10 00:31:30 +08:00
|
|
|
'mergeTitleFieldText': defaultSquashMergeTitle,
|
|
|
|
|
'mergeMessageFieldText': {{.GetCommitMessages}} + defaultSquashMergeMessage,
|
|
|
|
|
'hideAutoMerge': generalHideAutoMerge,
|
|
|
|
|
},
|
2024-02-12 14:37:23 -08:00
|
|
|
{
|
|
|
|
|
'name': 'fast-forward-only',
|
|
|
|
|
'allowed': {{and $prUnit.PullRequestsConfig.AllowFastForwardOnly (eq .Issue.PullRequest.CommitsBehind 0)}},
|
|
|
|
|
'textDoMerge': {{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}},
|
|
|
|
|
'hideMergeMessageTexts': true,
|
|
|
|
|
'hideAutoMerge': generalHideAutoMerge,
|
|
|
|
|
},
|
2023-02-10 00:31:30 +08:00
|
|
|
{
|
|
|
|
|
'name': 'manually-merged',
|
2023-10-30 04:13:06 +01:00
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowManualMerge}},
|
2023-09-25 10:56:50 +02:00
|
|
|
'textDoMerge': {{ctx.Locale.Tr "repo.pulls.merge_manually"}},
|
2023-02-10 00:31:30 +08:00
|
|
|
'hideMergeMessageTexts': true,
|
|
|
|
|
'hideAutoMerge': true,
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
window.config.pageData.pullRequestMergeForm = mergeForm;
|
2026-04-03 10:25:45 +08:00
|
|
|
})();
|
2022-06-11 16:44:20 +02:00
|
|
|
</script>
|
2022-05-12 21:39:02 +08:00
|
|
|
|
2023-02-21 18:03:41 +08:00
|
|
|
{{$showGeneralMergeForm = true}}
|
2026-02-27 06:06:15 +01:00
|
|
|
{{/* The merge form is a Vue component. After mounted, it has a button for choosing merge style, so make it have min-height to avoid layout shifting */}}
|
|
|
|
|
<div id="pull-request-merge-form" class="tw-min-h-[40px]"></div>
|
2020-01-11 08:29:34 +01:00
|
|
|
{{else}}
|
2022-06-11 16:44:20 +02:00
|
|
|
{{/* no merge style was set in repo setting: not or ($prUnit.PullRequestsConfig.AllowMerge ...) */}}
|
2023-06-29 14:24:22 +02:00
|
|
|
<div class="divider"></div>
|
2026-02-22 23:56:33 +01:00
|
|
|
<div class="item tw-text-red">
|
2022-06-11 16:44:20 +02:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.no_merge_desc"}}
|
2022-06-11 16:44:20 +02:00
|
|
|
</div>
|
2021-05-27 22:02:04 +02:00
|
|
|
<div class="item">
|
2020-09-11 22:19:00 +02:00
|
|
|
{{svg "octicon-info"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.no_merge_helper"}}
|
2020-01-11 08:29:34 +01:00
|
|
|
</div>
|
2022-06-11 16:44:20 +02:00
|
|
|
{{end}} {{/* end if the repo was set to use any merge style */}}
|
|
|
|
|
{{else}}
|
|
|
|
|
{{/* user is not allowed to merge */}}
|
2023-06-29 14:24:22 +02:00
|
|
|
<div class="divider"></div>
|
2022-06-11 16:44:20 +02:00
|
|
|
<div class="item">
|
|
|
|
|
{{svg "octicon-info"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.no_merge_access"}}
|
2022-06-11 16:44:20 +02:00
|
|
|
</div>
|
|
|
|
|
{{end}} {{/* end if user is allowed to merge or not */}}
|
2017-03-17 06:57:43 +01:00
|
|
|
{{else}}
|
2020-01-11 08:29:34 +01:00
|
|
|
{{/* Merge conflict without specific file. Suggest manual merge, only if all reviews and status checks OK. */}}
|
|
|
|
|
{{if .IsBlockedByApprovals}}
|
2026-02-22 23:56:33 +01:00
|
|
|
<div class="item tw-text-red">
|
2020-09-11 22:19:00 +02:00
|
|
|
{{svg "octicon-x"}}
|
2025-04-24 21:26:57 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .ProtectedBranch.RequiredApprovals}}
|
2020-01-11 08:29:34 +01:00
|
|
|
</div>
|
|
|
|
|
{{else if .IsBlockedByRejection}}
|
2026-02-22 23:56:33 +01:00
|
|
|
<div class="item tw-text-red">
|
2020-09-11 22:19:00 +02:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.blocked_by_rejection"}}
|
2020-11-29 03:30:46 +08:00
|
|
|
</div>
|
|
|
|
|
{{else if .IsBlockedByOfficialReviewRequests}}
|
2026-02-22 23:56:33 +01:00
|
|
|
<div class="item tw-text-red">
|
2020-11-29 03:30:46 +08:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.blocked_by_official_review_requests"}}
|
2020-01-11 08:29:34 +01:00
|
|
|
</div>
|
2020-04-17 03:00:36 +02:00
|
|
|
{{else if .IsBlockedByOutdatedBranch}}
|
2026-02-22 23:56:33 +01:00
|
|
|
<div class="item tw-text-red">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.blocked_by_outdated_branch"}}
|
2020-04-17 03:00:36 +02:00
|
|
|
</div>
|
2020-10-14 02:50:57 +08:00
|
|
|
{{else if .IsBlockedByChangedProtectedFiles}}
|
2026-02-22 23:56:33 +01:00
|
|
|
<div class="item tw-text-red">
|
2023-06-15 00:40:15 +08:00
|
|
|
{{svg "octicon-x"}}
|
2024-02-23 01:02:33 +08:00
|
|
|
{{ctx.Locale.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n"}}
|
2020-10-14 02:50:57 +08:00
|
|
|
</div>
|
2023-06-15 00:40:15 +08:00
|
|
|
<ul>
|
|
|
|
|
{{range .ChangedProtectedFiles}}
|
|
|
|
|
<li>{{.}}</li>
|
|
|
|
|
{{end}}
|
|
|
|
|
</ul>
|
2026-01-15 09:25:14 +11:00
|
|
|
{{else if and .EnableStatusCheck (not $requiredStatusCheckState.IsSuccess)}}
|
2026-02-22 23:56:33 +01:00
|
|
|
<div class="item tw-text-red">
|
2020-09-11 22:19:00 +02:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.required_status_check_failed"}}
|
2020-01-11 08:29:34 +01:00
|
|
|
</div>
|
2020-01-15 08:32:57 +00:00
|
|
|
{{else if and .RequireSigned (not .WillSign)}}
|
2026-02-22 23:56:33 +01:00
|
|
|
<div class="item tw-text-red">
|
2020-09-11 22:19:00 +02:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.require_signed_wont_sign"}}
|
2020-01-15 08:32:57 +00:00
|
|
|
</div>
|
2020-01-11 08:29:34 +01:00
|
|
|
{{else}}
|
2026-02-22 23:56:33 +01:00
|
|
|
<div class="item tw-text-red">
|
2020-09-11 22:19:00 +02:00
|
|
|
{{svg "octicon-x"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.cannot_auto_merge_desc"}}
|
2020-01-11 08:29:34 +01:00
|
|
|
</div>
|
2021-05-27 22:02:04 +02:00
|
|
|
<div class="item">
|
2020-09-11 22:19:00 +02:00
|
|
|
{{svg "octicon-info"}}
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.pulls.cannot_auto_merge_helper"}}
|
2020-01-11 08:29:34 +01:00
|
|
|
</div>
|
|
|
|
|
{{end}}
|
2023-02-21 18:03:41 +08:00
|
|
|
{{end}}{{/* end if: pull request status */}}
|
2020-06-14 02:49:59 +08:00
|
|
|
|
2024-12-25 00:51:13 +08:00
|
|
|
{{/* Manually Merged is not a well-known feature, it is used to mark a non-mergeable PR (already merged, conflicted) as merged
|
2023-04-24 03:48:51 +08:00
|
|
|
To test it:
|
|
|
|
|
* Enable "Manually Merged" feature in the Repository Settings
|
|
|
|
|
* Create a pull request, either:
|
|
|
|
|
* - Merge the pull request branch locally and push the merged commit to Gitea
|
|
|
|
|
* - Make some conflicts between the base branch and the pull request branch
|
2023-10-30 04:13:06 +01:00
|
|
|
* Then the Manually Merged form will be shown in the merge form
|
2023-04-24 03:48:51 +08:00
|
|
|
*/}}
|
2023-02-21 18:03:41 +08:00
|
|
|
{{if and $.StillCanManualMerge (not $showGeneralMergeForm)}}
|
2023-06-29 14:24:22 +02:00
|
|
|
<div class="divider"></div>
|
2025-04-24 21:26:57 +02:00
|
|
|
<form class="ui form form-fetch-action" action="{{.Issue.Link}}/merge" method="post">{{/* another similar form is in PullRequestMergeForm.vue*/}}
|
2024-03-22 19:17:30 +08:00
|
|
|
<div class="field">
|
|
|
|
|
<input type="text" name="merge_commit_id" placeholder="{{ctx.Locale.Tr "repo.pulls.merge_commit_id"}}">
|
|
|
|
|
</div>
|
|
|
|
|
<button class="ui red button" type="submit" name="do" value="manually-merged">
|
|
|
|
|
{{ctx.Locale.Tr "repo.pulls.merge_manually"}}
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
2021-03-04 11:41:23 +08:00
|
|
|
{{end}}
|
2023-02-15 23:31:35 +08:00
|
|
|
|
2023-10-25 17:01:31 +02:00
|
|
|
{{if and .Issue.PullRequest.HeadRepo (not .Issue.PullRequest.HasMerged) (not .Issue.IsClosed)}}
|
|
|
|
|
{{template "repo/issue/view_content/pull_merge_instruction" dict "PullRequest" .Issue.PullRequest "ShowMergeInstructions" .ShowMergeInstructions}}
|
2023-02-15 23:31:35 +08:00
|
|
|
{{end}}
|
2017-03-17 06:57:43 +01:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-05-03 21:52:19 +08:00
|
|
|
{{end}}
|