Merge branch 'origin/main' into 'next-release/main'

This commit is contained in:
oauth 2025-02-20 17:29:20 +00:00
commit dde88a2b35
5 changed files with 17 additions and 1 deletions

View file

@ -141,6 +141,12 @@ var flags = append([]cli.Flag{
Name: "authenticate-public-repos", Name: "authenticate-public-repos",
Usage: "Always use authentication to clone repositories even if they are public. Needed if the SCM requires to always authenticate as used by many companies.", Usage: "Always use authentication to clone repositories even if they are public. Needed if the SCM requires to always authenticate as used by many companies.",
}, },
&cli.BoolFlag{
Sources: cli.EnvVars("WOODPECKER_DEFAULT_ALLOW_PULL_REQUESTS"),
Name: "default-allow-pull-requests",
Usage: "The default value for allowing pull requests on a repo.",
Value: true,
},
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Sources: cli.EnvVars("WOODPECKER_DEFAULT_CANCEL_PREVIOUS_PIPELINE_EVENTS"), Sources: cli.EnvVars("WOODPECKER_DEFAULT_CANCEL_PREVIOUS_PIPELINE_EVENTS"),
Name: "default-cancel-previous-pipeline-events", Name: "default-cancel-previous-pipeline-events",

View file

@ -173,6 +173,9 @@ func setupEvilGlobals(ctx context.Context, c *cli.Command, s store.Store) (err e
// authentication // authentication
server.Config.Pipeline.AuthenticatePublicRepos = c.Bool("authenticate-public-repos") server.Config.Pipeline.AuthenticatePublicRepos = c.Bool("authenticate-public-repos")
// Pull requests
server.Config.Pipeline.DefaultAllowPullRequests = c.Bool("default-allow-pull-requests")
// Cloning // Cloning
server.Config.Pipeline.DefaultClonePlugin = c.String("default-clone-plugin") server.Config.Pipeline.DefaultClonePlugin = c.String("default-clone-plugin")
server.Config.Pipeline.TrustedClonePlugins = c.StringSlice("plugins-trusted-clone") server.Config.Pipeline.TrustedClonePlugins = c.StringSlice("plugins-trusted-clone")

View file

@ -337,6 +337,12 @@ Enable to allow user registration.
Always use authentication to clone repositories even if they are public. Needed if the forge requires to always authenticate as used by many companies. Always use authentication to clone repositories even if they are public. Needed if the forge requires to always authenticate as used by many companies.
### `WOODPECKER_DEFAULT_ALLOW_PULL_REQUESTS`
> Default: `true`
The default setting for allowing pull requests on a repo.
### `WOODPECKER_DEFAULT_CANCEL_PREVIOUS_PIPELINE_EVENTS` ### `WOODPECKER_DEFAULT_CANCEL_PREVIOUS_PIPELINE_EVENTS`
> Default: `pull_request, push` > Default: `pull_request, push`

View file

@ -92,7 +92,7 @@ func PostRepo(c *gin.Context) {
} else { } else {
repo = from repo = from
repo.RequireApproval = model.RequireApprovalForks repo.RequireApproval = model.RequireApprovalForks
repo.AllowPull = true repo.AllowPull = server.Config.Pipeline.DefaultAllowPullRequests
repo.AllowDeploy = false repo.AllowDeploy = false
repo.CancelPreviousPipelineEvents = server.Config.Pipeline.DefaultCancelPreviousPipelineEvents repo.CancelPreviousPipelineEvents = server.Config.Pipeline.DefaultCancelPreviousPipelineEvents
} }

View file

@ -66,6 +66,7 @@ var Config = struct {
} }
Pipeline struct { Pipeline struct {
AuthenticatePublicRepos bool AuthenticatePublicRepos bool
DefaultAllowPullRequests bool
DefaultCancelPreviousPipelineEvents []model.WebhookEvent DefaultCancelPreviousPipelineEvents []model.WebhookEvent
DefaultWorkflowLabels map[string]string DefaultWorkflowLabels map[string]string
DefaultClonePlugin string DefaultClonePlugin string