Skip to content

Commit ad6a912

Browse files
committed
fix: make repository argument required
1 parent d63ad78 commit ad6a912

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

github/resource_github_repository_ruleset.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"log"
77
"net/http"
8+
"regexp"
89
"strconv"
910

1011
"github.com/google/go-github/v66/github"
@@ -38,9 +39,10 @@ func resourceGithubRepositoryRuleset() *schema.Resource {
3839
Description: "Possible values are `branch` and `tag`.",
3940
},
4041
"repository": {
41-
Type: schema.TypeString,
42-
Optional: true,
43-
Description: "Name of the repository to apply rulset to.",
42+
Type: schema.TypeString,
43+
Required: true,
44+
ValidateDiagFunc: toDiagFunc(validation.StringMatch(regexp.MustCompile(`^[-a-zA-Z0-9_.]{1,100}$`), "must include only alphanumeric characters, underscores or hyphens and consist of 100 characters or less"), "name"),
45+
Description: "Name of the repository to apply rulset to.",
4446
},
4547
"enforcement": {
4648
Type: schema.TypeString,

website/docs/r/repository_ruleset.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ resource "github_repository_ruleset" "example" {
6868

6969
* `conditions` - (Optional) (Block List, Max: 1) Parameters for a repository ruleset ref name condition. (see [below for nested schema](#conditions))
7070

71-
* `repository` - (Optional) (String) Name of the repository to apply rulset to.
71+
* `repository` - (Required) (String) Name of the repository to apply rulset to.
7272

7373
#### Rules ####
7474

0 commit comments

Comments
 (0)