Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
patrickmarabeas committed May 11, 2020
1 parent 24a0b33 commit 75d7f30
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
@@ -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,
@@ -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())
1 change: 1 addition & 0 deletions github/data_source_github_repository_test.go
Original file line number Diff line number Diff line change
@@ -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"),
2 changes: 2 additions & 0 deletions website/docs/d/repository.html.markdown
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 75d7f30

Please sign in to comment.