Skip to content

Commit

Permalink
fix: Fixed team data source detailed repos
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Hipwell <[email protected]>
  • Loading branch information
stevehipwell committed Dec 6, 2024
1 parent 1c11053 commit f2246d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions github/data_source_github_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ func dataSourceGithubTeam() *schema.Resource {
Elem: &schema.Schema{Type: schema.TypeString},
},
"repositories": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Deprecated: "Use repositories_detailed instead.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"repositories_detailed": {
Type: schema.TypeList,
Expand All @@ -56,6 +57,10 @@ func dataSourceGithubTeam() *schema.Resource {
Type: schema.TypeInt,
Computed: true,
},
"repo_name": {
Type: schema.TypeString,
Computed: true,
},
"role_name": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -168,7 +173,7 @@ func dataSourceGithubTeamRead(d *schema.ResourceData, meta interface{}) error {
}
}

repositories_detailed = make([]interface{}, 0, resultsPerPage) //removed this from the loop
repositories_detailed = make([]interface{}, 0, resultsPerPage) // removed this from the loop

for {
repository, resp, err := client.Teams.ListTeamReposByID(ctx, orgId, team.GetID(), &options.ListOptions)
Expand All @@ -180,6 +185,7 @@ func dataSourceGithubTeamRead(d *schema.ResourceData, meta interface{}) error {
repositories = append(repositories, v.GetName())
repositories_detailed = append(repositories_detailed, map[string]interface{}{
"repo_id": v.GetID(),
"repo_name": v.GetName(),
"role_name": v.GetRoleName(),
})
}
Expand Down
4 changes: 2 additions & 2 deletions website/docs/d/team.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ data "github_team" "example" {
* `privacy` - the team's privacy type.
* `permission` - the team's permission level.
* `members` - List of team members (list of GitHub usernames). Not returned if `summary_only = true`
* `repositories` - List of team repositories (list of repo names). Not returned if `summary_only = true`
* `repositories_detailed` - List of team repositories (list of `repo_id` and [`role_name`](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team_repository#permission)). Not returned if `summary_only = true`
* `repositories` - (**DEPRECATED**) List of team repositories (list of repo names). Not returned if `summary_only = true`
* `repositories_detailed` - List of team repositories (each item comprises of `repo_id`, `repo_name` & [`role_name`](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team_repository#permission)). Not returned if `summary_only = true`

0 comments on commit f2246d2

Please sign in to comment.