Skip to content

Commit f9b0678

Browse files
mikutasvedantthapa
andauthored
fix: make repository argument required (#2603)
* fix: make repository argument required * fix: typo Co-authored-by: Vedant Thapa <43611693+vedantthapa@users.noreply.github.com> * fix: typo Co-authored-by: Vedant Thapa <43611693+vedantthapa@users.noreply.github.com> --------- Co-authored-by: Vedant Thapa <43611693+vedantthapa@users.noreply.github.com>
1 parent c568ac1 commit f9b0678

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
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"log"
88
"net/http"
9+
"regexp"
910
"strconv"
1011

1112
"github.com/google/go-github/v67/github"
@@ -39,9 +40,10 @@ func resourceGithubRepositoryRuleset() *schema.Resource {
3940
Description: "Possible values are `branch`, `push` and `tag`.",
4041
},
4142
"repository": {
42-
Type: schema.TypeString,
43-
Optional: true,
44-
Description: "Name of the repository to apply rulset to.",
43+
Type: schema.TypeString,
44+
Required: true,
45+
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"),
46+
Description: "Name of the repository to apply ruleset to.",
4547
},
4648
"enforcement": {
4749
Type: schema.TypeString,

website/docs/r/repository_ruleset.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ resource "github_repository_ruleset" "example_push" {
100100

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

103-
* `repository` - (Optional) (String) Name of the repository to apply rulset to.
103+
* `repository` - (Required) (String) Name of the repository to apply ruleset to.
104104

105105
#### Rules ####
106106

0 commit comments

Comments
 (0)