mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-19 02:33:21 +00:00
Add default option for allowing pull requests on repositories (#4873)
This commit is contained in:
@@ -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",
|
||||||
|
@@ -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")
|
||||||
|
@@ -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`
|
||||||
|
@@ -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
|
||||||
}
|
}
|
||||||
|
@@ -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
|
||||||
|
Reference in New Issue
Block a user