Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixed team data source detailed repos #2509

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`
Loading