From 53586e9d609d61204a750b11cd3990b4ba923e24 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Wed, 26 Jul 2023 02:31:09 +0900 Subject: [PATCH] Avoid opening/closing PRs which are already merged (#25883) (#26108) --- routers/web/repo/issue.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 616e08e4d88..0e6c7ad2bd7 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -2654,6 +2654,13 @@ func UpdateIssueStatus(ctx *context.Context) { return } for _, issue := range issues { + if err := issue.LoadPullRequest(ctx); err != nil { + ctx.ServerError("LoadPullRequests", err) + return + } + if issue.IsPull && issue.PullRequest.HasMerged { + continue + } if issue.IsClosed != isClosed { if err := issue_service.ChangeStatus(issue, ctx.Doer, "", isClosed); err != nil { if issues_model.IsErrDependenciesLeft(err) {