Skip to content

Commit

Permalink
Add flag to toggle autoplanning on draft PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
cket authored and lkysow committed May 25, 2020
1 parent aa01df6 commit c300dee
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const (
GitlabWebhookSecretFlag = "gitlab-webhook-secret" // nolint: gosec
HidePrevPlanComments = "hide-prev-plan-comments"
LogLevelFlag = "log-level"
PlanDrafts = "plan-drafts"
PortFlag = "port"
RepoConfigFlag = "repo-config"
RepoConfigJSONFlag = "repo-config-json"
Expand Down Expand Up @@ -258,6 +259,10 @@ var boolFlags = map[string]boolFlag{
"VCS support is limited to: GitHub.",
defaultValue: false,
},
PlanDrafts: {
description: "Enable autoplan for Github Draft Pull Requests",
defaultValue: false,
},
RequireApprovalFlag: {
description: "Require pull requests to be \"Approved\" before allowing the apply command to be run.",
defaultValue: false,
Expand Down
1 change: 1 addition & 0 deletions cmd/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ var testFlags = map[string]interface{}{
GitlabUserFlag: "gitlab-user",
GitlabWebhookSecretFlag: "gitlab-secret",
LogLevelFlag: "debug",
PlanDrafts: true,
PortFlag: 8181,
RepoWhitelistFlag: "github.com/runatlantis/atlantis",
RequireApprovalFlag: true,
Expand Down
1 change: 1 addition & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ func NewServer(userConfig UserConfig, config Config) (*Server, error) {
GithubToken: userConfig.GithubToken,
GitlabUser: userConfig.GitlabUser,
GitlabToken: userConfig.GitlabToken,
PlanDrafts: userConfig.PlanDrafts,
BitbucketUser: userConfig.BitbucketUser,
BitbucketToken: userConfig.BitbucketToken,
BitbucketServerURL: userConfig.BitbucketBaseURL,
Expand Down
1 change: 1 addition & 0 deletions server/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type UserConfig struct {
GitlabWebhookSecret string `mapstructure:"gitlab-webhook-secret"`
HidePrevPlanComments bool `mapstructure:"hide-prev-plan-comments"`
LogLevel string `mapstructure:"log-level"`
PlanDrafts bool `mapstructure:"plan-drafts"`
Port int `mapstructure:"port"`
RepoConfig string `mapstructure:"repo-config"`
RepoConfigJSON string `mapstructure:"repo-config-json"`
Expand Down

0 comments on commit c300dee

Please sign in to comment.