From 27211a8eabbe5b6a3faa4c8aa8058014f6f0f1ae Mon Sep 17 00:00:00 2001 From: Patrick Marabeas Date: Sat, 2 May 2020 21:41:14 +1000 Subject: [PATCH] Add visibility parameter to repository data source Adds the additional visibility parameter allowing for enterprise accounts to have set the repository to be only internally visible. Resolves #304 --- github/data_source_github_repository.go | 5 +++++ github/data_source_github_repository_test.go | 1 + website/docs/d/repository.html.markdown | 2 ++ 3 files changed, 8 insertions(+) diff --git a/github/data_source_github_repository.go b/github/data_source_github_repository.go index 065310ff58..7d69cb9b10 100644 --- a/github/data_source_github_repository.go +++ b/github/data_source_github_repository.go @@ -37,6 +37,10 @@ func dataSourceGithubRepository() *schema.Resource { Type: schema.TypeBool, Computed: true, }, + "visibility": { + Type: schema.TypeBool, + 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()) diff --git a/github/data_source_github_repository_test.go b/github/data_source_github_repository_test.go index c7b426f168..22cb0e334e 100644 --- a/github/data_source_github_repository_test.go +++ b/github/data_source_github_repository_test.go @@ -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"), diff --git a/website/docs/d/repository.html.markdown b/website/docs/d/repository.html.markdown index 99b1404d16..14247da86a 100644 --- a/website/docs/d/repository.html.markdown +++ b/website/docs/d/repository.html.markdown @@ -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.