From 23f58fc07a874c821b68fe30bb2733800e8d3301 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 17 Dec 2023 17:44:48 +0100 Subject: [PATCH] Fix broken gated repos (#2959) Fixes a bug introduced in https://github.com/woodpecker-ci/woodpecker/pull/2923. I'll also try to add a test case. --- server/pipeline/create.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/pipeline/create.go b/server/pipeline/create.go index 64bd6f623..7d711af34 100644 --- a/server/pipeline/create.go +++ b/server/pipeline/create.go @@ -87,10 +87,6 @@ func Create(ctx context.Context, _store store.Store, repo *model.Repo, pipeline return nil, ErrFiltered } - if err := updatePipelinePending(ctx, _store, pipeline, repo, repoUser); err != nil { - return nil, err - } - pipeline = setPipelineStepsOnPipeline(pipeline, pipelineItems) // persist the pipeline config for historical correctness, restarts, etc @@ -116,6 +112,10 @@ func Create(ctx context.Context, _store store.Store, repo *model.Repo, pipeline return pipeline, nil } + if err := updatePipelinePending(ctx, _store, pipeline, repo, repoUser); err != nil { + return nil, err + } + pipeline, err = start(ctx, _store, pipeline, repoUser, repo, pipelineItems) if err != nil { msg := fmt.Sprintf("failed to start pipeline for %s", repo.FullName)