Skip to content

Commit 89aa2c5

Browse files
Add fork attribute to github_repository data (#1647)
* Add fork property * add test
1 parent e83bb8d commit 89aa2c5

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

github/data_source_github_repository.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ func dataSourceGithubRepository() *schema.Resource {
7070
Type: schema.TypeBool,
7171
Computed: true,
7272
},
73+
"fork": {
74+
Type: schema.TypeBool,
75+
Computed: true,
76+
},
7377
"allow_merge_commit": {
7478
Type: schema.TypeBool,
7579
Computed: true,
@@ -251,6 +255,7 @@ func dataSourceGithubRepositoryRead(d *schema.ResourceData, meta interface{}) er
251255
d.Set("has_discussions", repo.GetHasDiscussions())
252256
d.Set("has_wiki", repo.GetHasWiki())
253257
d.Set("is_template", repo.GetIsTemplate())
258+
d.Set("fork", repo.GetFork())
254259
d.Set("allow_merge_commit", repo.GetAllowMergeCommit())
255260
d.Set("allow_squash_merge", repo.GetAllowSquashMerge())
256261
d.Set("allow_rebase_merge", repo.GetAllowRebaseMerge())

github/data_source_github_repository_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ func TestAccGithubRepositoryDataSource(t *testing.T) {
137137
resource.TestCheckResourceAttr(
138138
"data.github_repository.test", "pages.#", "0",
139139
),
140+
resource.TestCheckResourceAttr(
141+
"data.github_repository.test", "fork", "false",
142+
),
140143
)
141144

142145
testCase := func(t *testing.T, mode string) {

website/docs/d/repository.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ The following arguments are supported:
4747

4848
* `is_template` - Whether the repository is a template repository.
4949

50+
* `fork` - Whether the repository is a fork.
51+
5052
* `allow_merge_commit` - Whether the repository allows merge commits.
5153

5254
* `allow_squash_merge` - Whether the repository allows squash merges.

0 commit comments

Comments
 (0)