From 23efd9d2781c2ac22594a83afa75182d276b1571 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 22 Jan 2024 10:13:24 +0800 Subject: [PATCH 1/5] Fix schedule not trigger bug because matching full ref name with short ref name (#28874) Fix #28533 Caused by #28691 --- services/actions/notifier_helper.go | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/services/actions/notifier_helper.go b/services/actions/notifier_helper.go index 0618f15602ee5..2a3ffb76f30d2 100644 --- a/services/actions/notifier_helper.go +++ b/services/actions/notifier_helper.go @@ -159,24 +159,28 @@ func notify(ctx context.Context, input *notifyInput) error { workflows, schedules, err := actions_module.DetectWorkflows(gitRepo, commit, input.Event, input.Payload, - input.Event == webhook_module.HookEventPush && input.Ref == input.Repo.DefaultBranch, + input.Event == webhook_module.HookEventPush && git.RefName(input.Ref).BranchName() == input.Repo.DefaultBranch, ) if err != nil { return fmt.Errorf("DetectWorkflows: %w", err) } - if len(workflows) == 0 { - log.Trace("repo %s with commit %s couldn't find workflows", input.Repo.RepoPath(), commit.ID) - } else { - for _, wf := range workflows { - if actionsConfig.IsWorkflowDisabled(wf.EntryName) { - log.Trace("repo %s has disable workflows %s", input.Repo.RepoPath(), wf.EntryName) - continue - } + log.Trace("repo %s with commit %s event %s find %d workflows and %d schedules", + input.Repo.RepoPath(), + commit.ID, + input.Event, + len(workflows), + len(schedules), + ) - if wf.TriggerEvent.Name != actions_module.GithubEventPullRequestTarget { - detectedWorkflows = append(detectedWorkflows, wf) - } + for _, wf := range workflows { + if actionsConfig.IsWorkflowDisabled(wf.EntryName) { + log.Trace("repo %s has disable workflows %s", input.Repo.RepoPath(), wf.EntryName) + continue + } + + if wf.TriggerEvent.Name != actions_module.GithubEventPullRequestTarget { + detectedWorkflows = append(detectedWorkflows, wf) } } From 8e9b6817bc2032c5af607b63d70ffc7e6599ebbb Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Mon, 22 Jan 2024 08:19:56 +0100 Subject: [PATCH 2/5] Fix `DeleteCollaboration` transaction behaviour (#28886) The method can't be called with an outer transaction because if the user is not a collaborator the outer transaction will be rolled back even if the inner transaction uses the no-error path. `has == 0` leads to `return nil` which cancels the transaction. A standalone call of this method does nothing but if used with an outer transaction, that will be canceled. --- services/repository/collaboration.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/repository/collaboration.go b/services/repository/collaboration.go index eff33c71f3ccf..dccc124748136 100644 --- a/services/repository/collaboration.go +++ b/services/repository/collaboration.go @@ -26,9 +26,12 @@ func DeleteCollaboration(ctx context.Context, repo *repo_model.Repository, uid i } defer committer.Close() - if has, err := db.GetEngine(ctx).Delete(collaboration); err != nil || has == 0 { + if has, err := db.GetEngine(ctx).Delete(collaboration); err != nil { return err - } else if err = access_model.RecalculateAccesses(ctx, repo); err != nil { + } else if has == 0 { + return committer.Commit() + } + if err = access_model.RecalculateAccesses(ctx, repo); err != nil { return err } From 77506c6f6cbfa5c15d8373743415f47b2adb404d Mon Sep 17 00:00:00 2001 From: Luca Zulberti Date: Mon, 22 Jan 2024 08:56:17 +0100 Subject: [PATCH 3/5] Add missing exclusive in advanced label options (#28322) Hi, I think these changes could be useful for default labels when creating new repos. The PR includes the following changes: - Add missing exclusive flag for Kind/ scope in labels. - Move Breaking label into new Compat/ scope. --- options/label/Advanced.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/options/label/Advanced.yaml b/options/label/Advanced.yaml index 27b2c146372b3..b1ecdd6d93e84 100644 --- a/options/label/Advanced.yaml +++ b/options/label/Advanced.yaml @@ -14,12 +14,12 @@ labels: - name: "Kind/Testing" color: 795548 description: Issue or pull request related to testing - - name: "Kind/Breaking" - color: c62828 - description: Breaking change that won't be backward compatible - name: "Kind/Documentation" color: 37474f description: Documentation changes + - name: "Compat/Breaking" + color: c62828 + description: Breaking change that won't be backward compatible - name: "Reviewed/Duplicate" exclusive: true color: 616161 From 4abd63d3784ab5e374b9efcf16a7b20a951f00dc Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 22 Jan 2024 18:24:55 +0800 Subject: [PATCH 4/5] Upgrade xorm to v1.3.7 to fix a resource leak problem caused by Iterate (#28891) Mainly fix an error https://gitea.com/xorm/xorm/issues/2393 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 7bf08048719e3..59278324d401f 100644 --- a/go.mod +++ b/go.mod @@ -121,7 +121,7 @@ require ( mvdan.cc/xurls/v2 v2.5.0 strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 xorm.io/builder v0.3.13 - xorm.io/xorm v1.3.7-0.20240101024435-4992cba040fe + xorm.io/xorm v1.3.7 ) require ( diff --git a/go.sum b/go.sum index 52aeabfeac5ce..bf1ae82b8e73a 100644 --- a/go.sum +++ b/go.sum @@ -1380,5 +1380,5 @@ strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 h1:mUcz5b3 strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251/go.mod h1:FJGmPh3vz9jSos1L/F91iAgnC/aejc0wIIrF2ZwJxdY= xorm.io/builder v0.3.13 h1:a3jmiVVL19psGeXx8GIurTp7p0IIgqeDmwhcR6BAOAo= xorm.io/builder v0.3.13/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE= -xorm.io/xorm v1.3.7-0.20240101024435-4992cba040fe h1:c+IGxoesJV3s4QZb55feZIb1sqFEUluAYHpe5uJIO6U= -xorm.io/xorm v1.3.7-0.20240101024435-4992cba040fe/go.mod h1:/PjYRKEcJ67WtOnb6DXEMb2Y0uWFaZSoDlhJUebWbXw= +xorm.io/xorm v1.3.7 h1:mLceAGu0b87r9pD4qXyxGHxifOXIIrAdVcA6k95/osw= +xorm.io/xorm v1.3.7/go.mod h1:LsCCffeeYp63ssk0pKumP6l96WZcHix7ChpurcLNuMw= From c4cdebacfeeecac259273f3ff62c0139131ba490 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 23 Jan 2024 09:17:42 +0800 Subject: [PATCH 5/5] Fix sort bug on repository issues list (#28897) Fix #28896 --- modules/indexer/issues/db/options.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/indexer/issues/db/options.go b/modules/indexer/issues/db/options.go index b827a24589f96..5406715bbcfb2 100644 --- a/modules/indexer/issues/db/options.go +++ b/modules/indexer/issues/db/options.go @@ -38,7 +38,7 @@ func ToDBOptions(ctx context.Context, options *internal.SearchOptions) (*issue_m sortType = "leastupdate" case internal.SortByCommentsAsc: sortType = "leastcomment" - case internal.SortByDeadlineAsc: + case internal.SortByDeadlineDesc: sortType = "farduedate" case internal.SortByCreatedDesc: sortType = "newest" @@ -46,7 +46,7 @@ func ToDBOptions(ctx context.Context, options *internal.SearchOptions) (*issue_m sortType = "recentupdate" case internal.SortByCommentsDesc: sortType = "mostcomment" - case internal.SortByDeadlineDesc: + case internal.SortByDeadlineAsc: sortType = "nearduedate" default: sortType = "newest"