Skip to content

Commit

Permalink
Add visibility parameter to repository data source
Browse files Browse the repository at this point in the history
Adds the additional visibility parameter allowing for enterprise
accounts to have set the repository to be only internally visible.

Resolves #304
  • Loading branch information
patrickmarabeas committed May 12, 2020
1 parent aafd2ba commit 4914739
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions github/data_source_github_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func dataSourceGithubRepository() *schema.Resource {
Type: schema.TypeBool,
Computed: true,
},
"visibility": {
Type: schema.TypeString,
Computed: true,
},
"has_issues": {
Type: schema.TypeBool,
Computed: true,
Expand Down Expand Up @@ -143,6 +147,7 @@ func dataSourceGithubRepositoryRead(d *schema.ResourceData, meta interface{}) er
d.Set("description", repo.GetDescription())
d.Set("homepage_url", repo.GetHomepage())
d.Set("private", repo.GetPrivate())
d.Set("visibility", repo.GetVisibility())
d.Set("has_issues", repo.GetHasIssues())
d.Set("has_wiki", repo.GetHasWiki())
d.Set("allow_merge_commit", repo.GetAllowMergeCommit())
Expand Down
1 change: 1 addition & 0 deletions github/data_source_github_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func testRepoCheck() resource.TestCheckFunc {
resource.TestCheckResourceAttr("data.github_repository.test", "id", "test-repo"),
resource.TestCheckResourceAttr("data.github_repository.test", "name", "test-repo"),
resource.TestCheckResourceAttr("data.github_repository.test", "private", "false"),
resource.TestCheckResourceAttr("data.github_repository.test", "visibility", "public"),
resource.TestCheckResourceAttr("data.github_repository.test", "description", "Test description, used in GitHub Terraform provider acceptance test."),
resource.TestCheckResourceAttr("data.github_repository.test", "homepage_url", "http://www.example.com"),
resource.TestCheckResourceAttr("data.github_repository.test", "has_issues", "true"),
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/repository.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ The following arguments are supported:

* `private` - Whether the repository is private.

* `visibility` - Whether the repository is public, private or internal.

* `has_issues` - Whether the repository has GitHub Issues enabled.

* `has_projects` - Whether the repository has the GitHub Projects enabled.
Expand Down

0 comments on commit 4914739

Please sign in to comment.