From 2db77541ceb7041df06d5bc5853c7160c9c0808f Mon Sep 17 00:00:00 2001 From: Martyn Cross Date: Sun, 8 Sep 2024 11:00:38 +0700 Subject: [PATCH] feat: add default values for merge_queue on rulesets --- github/resource_github_repository_ruleset.go | 21 ++++++++++++------- .../docs/r/repository_ruleset.html.markdown | 14 ++++++------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/github/resource_github_repository_ruleset.go b/github/resource_github_repository_ruleset.go index bf6c918f46..ef3896f63f 100644 --- a/github/resource_github_repository_ruleset.go +++ b/github/resource_github_repository_ruleset.go @@ -262,44 +262,51 @@ func resourceGithubRepositoryRuleset() *schema.Resource { "check_response_timeout_minutes": { Type: schema.TypeInt, Optional: true, + Default: 60, ValidateDiagFunc: toDiagFunc(validation.IntBetween(0, 360), "check_response_timeout_minutes"), - Description: "Maximum time for a required status check to report a conclusion. After this much time has elapsed, checks that have not reported a conclusion will be assumed to have failed.", + Description: "Maximum time for a required status check to report a conclusion. After this much time has elapsed, checks that have not reported a conclusion will be assumed to have failed. Defaults to `60`.", }, "grouping_strategy": { Type: schema.TypeString, Optional: true, + Default: "ALLGREEN", ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"ALLGREEN", "HEADGREEN"}, false), "grouping_strategy"), - Description: "When set to ALLGREEN, the merge commit created by merge queue for each PR in the group must pass all required checks to merge. When set to HEADGREEN, only the commit at the head of the merge group, i.e. the commit containing changes from all of the PRs in the group, must pass its required checks to merge. Can be one of: ALLGREEN, HEADGREEN.", + Description: "When set to ALLGREEN, the merge commit created by merge queue for each PR in the group must pass all required checks to merge. When set to HEADGREEN, only the commit at the head of the merge group, i.e. the commit containing changes from all of the PRs in the group, must pass its required checks to merge. Can be one of: ALLGREEN, HEADGREEN. Defaults to `ALLGREEN`.", }, "max_entries_to_build": { Type: schema.TypeInt, Optional: true, + Default: 5, ValidateDiagFunc: toDiagFunc(validation.IntBetween(0, 100), "max_entries_to_merge"), - Description: "Limit the number of queued pull requests requesting checks and workflow runs at the same time.", + Description: "Limit the number of queued pull requests requesting checks and workflow runs at the same time. Defaults to `5`.", }, "max_entries_to_merge": { Type: schema.TypeInt, Optional: true, + Default: 5, ValidateDiagFunc: toDiagFunc(validation.IntBetween(0, 100), "max_entries_to_merge"), - Description: "The maximum number of PRs that will be merged together in a group.", + Description: "The maximum number of PRs that will be merged together in a group. Defaults to `5`.", }, "merge_method": { Type: schema.TypeString, Optional: true, + Default: "MERGE", ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"MERGE", "SQUASH", "REBASE"}, false), "merge_method"), - Description: "Method to use when merging changes from queued pull requests. Can be one of: MERGE, SQUASH, REBASE.", + Description: "Method to use when merging changes from queued pull requests. Can be one of: MERGE, SQUASH, REBASE. Defaults to `MERGE`.", }, "min_entries_to_merge": { Type: schema.TypeInt, Optional: true, + Default: 1, ValidateDiagFunc: toDiagFunc(validation.IntBetween(0, 100), "min_entries_to_merge"), - Description: "The minimum number of PRs that will be merged together in a group.", + Description: "The minimum number of PRs that will be merged together in a group. Defaults to `1`.", }, "min_entries_to_merge_wait_minutes": { Type: schema.TypeInt, Optional: true, + Default: 5, ValidateDiagFunc: toDiagFunc(validation.IntBetween(0, 360), "min_entries_to_merge_wait_minutes"), - Description: "The time merge queue should wait after the first PR is added to the queue for the minimum group size to be met. After this time has elapsed, the minimum group size will be ignored and a smaller group will be merged.", + Description: "The time merge queue should wait after the first PR is added to the queue for the minimum group size to be met. After this time has elapsed, the minimum group size will be ignored and a smaller group will be merged. Defaults to `5`.", }, }, }, diff --git a/website/docs/r/repository_ruleset.html.markdown b/website/docs/r/repository_ruleset.html.markdown index 227b7883dc..de88037315 100644 --- a/website/docs/r/repository_ruleset.html.markdown +++ b/website/docs/r/repository_ruleset.html.markdown @@ -148,19 +148,19 @@ The `rules` block supports the following: #### rules.merge_queue #### -* `check_response_timeout_minutes` - (Required) (Number)Maximum time for a required status check to report a conclusion. After this much time has elapsed, checks that have not reported a conclusion will be assumed to have failed. +* `check_response_timeout_minutes` - (Required) (Number)Maximum time for a required status check to report a conclusion. After this much time has elapsed, checks that have not reported a conclusion will be assumed to have failed. Defaults to `60`. -* `grouping_strategy` - (Required) (String)When set to ALLGREEN, the merge commit created by merge queue for each PR in the group must pass all required checks to merge. When set to HEADGREEN, only the commit at the head of the merge group, i.e. the commit containing changes from all of the PRs in the group, must pass its required checks to merge. Can be one of: ALLGREEN, HEADGREEN. +* `grouping_strategy` - (Required) (String)When set to ALLGREEN, the merge commit created by merge queue for each PR in the group must pass all required checks to merge. When set to HEADGREEN, only the commit at the head of the merge group, i.e. the commit containing changes from all of the PRs in the group, must pass its required checks to merge. Can be one of: ALLGREEN, HEADGREEN. Defaults to `ALLGREEN`. -* `max_entries_to_build` - (Required) (Number) Limit the number of queued pull requests requesting checks and workflow runs at the same time. +* `max_entries_to_build` - (Required) (Number) Limit the number of queued pull requests requesting checks and workflow runs at the same time. Defaults to `5`. -* `max_entries_to_merge` - (Required) (Number) Limit the number of queued pull requests requesting checks and workflow runs at the same time. +* `max_entries_to_merge` - (Required) (Number) Limit the number of queued pull requests requesting checks and workflow runs at the same time. Defaults to `5`. -* `merge_method` - (Required) (String) Method to use when merging changes from queued pull requests. Can be one of: MERGE, SQUASH, REBASE. +* `merge_method` - (Required) (String) Method to use when merging changes from queued pull requests. Can be one of: MERGE, SQUASH, REBASE. Defaults to `MERGE`. -* `min_entries_to_merge` - (Required) (Number) The minimum number of PRs that will be merged together in a group. +* `min_entries_to_merge` - (Required) (Number) The minimum number of PRs that will be merged together in a group. Defaults to `1`. -* `min_entries_to_merge_wait_minutes` - (Required) (Number) The time merge queue should wait after the first PR is added to the queue for the minimum group size to be met. After this time has elapsed, the minimum group size will be ignored and a smaller group will be merged. +* `min_entries_to_merge_wait_minutes` - (Required) (Number) The time merge queue should wait after the first PR is added to the queue for the minimum group size to be met. After this time has elapsed, the minimum group size will be ignored and a smaller group will be merged. Defaults to `5`. #### rules.pull_request ####