1. Packages
  2. Github Provider
  3. API Docs
  4. getOrganizationTeams
GitHub v6.7.0 published on Friday, Feb 28, 2025 by Pulumi

github.getOrganizationTeams

Explore with Pulumi AI

Use this data source to retrieve information about all GitHub teams in an organization.

Example Usage

To retrieve all teams of the organization:

import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";

const all = github.getOrganizationTeams({});
Copy
import pulumi
import pulumi_github as github

all = github.get_organization_teams()
Copy
package main

import (
	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := github.GetOrganizationTeams(ctx, &github.GetOrganizationTeamsArgs{}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;

return await Deployment.RunAsync(() => 
{
    var all = Github.GetOrganizationTeams.Invoke();

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.GithubFunctions;
import com.pulumi.github.inputs.GetOrganizationTeamsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var all = GithubFunctions.getOrganizationTeams();

    }
}
Copy
variables:
  all:
    fn::invoke:
      function: github:getOrganizationTeams
      arguments: {}
Copy

To retrieve only the team’s at the root of the organization:

import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";

const rootTeams = github.getOrganizationTeams({
    rootTeamsOnly: true,
});
Copy
import pulumi
import pulumi_github as github

root_teams = github.get_organization_teams(root_teams_only=True)
Copy
package main

import (
	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := github.GetOrganizationTeams(ctx, &github.GetOrganizationTeamsArgs{
			RootTeamsOnly: pulumi.BoolRef(true),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;

return await Deployment.RunAsync(() => 
{
    var rootTeams = Github.GetOrganizationTeams.Invoke(new()
    {
        RootTeamsOnly = true,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.GithubFunctions;
import com.pulumi.github.inputs.GetOrganizationTeamsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var rootTeams = GithubFunctions.getOrganizationTeams(GetOrganizationTeamsArgs.builder()
            .rootTeamsOnly(true)
            .build());

    }
}
Copy
variables:
  rootTeams:
    fn::invoke:
      function: github:getOrganizationTeams
      arguments:
        rootTeamsOnly: true
Copy

Using getOrganizationTeams

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getOrganizationTeams(args: GetOrganizationTeamsArgs, opts?: InvokeOptions): Promise<GetOrganizationTeamsResult>
function getOrganizationTeamsOutput(args: GetOrganizationTeamsOutputArgs, opts?: InvokeOptions): Output<GetOrganizationTeamsResult>
Copy
def get_organization_teams(results_per_page: Optional[int] = None,
                           root_teams_only: Optional[bool] = None,
                           summary_only: Optional[bool] = None,
                           opts: Optional[InvokeOptions] = None) -> GetOrganizationTeamsResult
def get_organization_teams_output(results_per_page: Optional[pulumi.Input[int]] = None,
                           root_teams_only: Optional[pulumi.Input[bool]] = None,
                           summary_only: Optional[pulumi.Input[bool]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetOrganizationTeamsResult]
Copy
func GetOrganizationTeams(ctx *Context, args *GetOrganizationTeamsArgs, opts ...InvokeOption) (*GetOrganizationTeamsResult, error)
func GetOrganizationTeamsOutput(ctx *Context, args *GetOrganizationTeamsOutputArgs, opts ...InvokeOption) GetOrganizationTeamsResultOutput
Copy

> Note: This function is named GetOrganizationTeams in the Go SDK.

public static class GetOrganizationTeams 
{
    public static Task<GetOrganizationTeamsResult> InvokeAsync(GetOrganizationTeamsArgs args, InvokeOptions? opts = null)
    public static Output<GetOrganizationTeamsResult> Invoke(GetOrganizationTeamsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetOrganizationTeamsResult> getOrganizationTeams(GetOrganizationTeamsArgs args, InvokeOptions options)
public static Output<GetOrganizationTeamsResult> getOrganizationTeams(GetOrganizationTeamsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: github:index/getOrganizationTeams:getOrganizationTeams
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

ResultsPerPage int
(Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to 100.
RootTeamsOnly bool
(Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
SummaryOnly bool
(Optional) Exclude the members and repositories of the team from the returned result. Defaults to false.
ResultsPerPage int
(Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to 100.
RootTeamsOnly bool
(Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
SummaryOnly bool
(Optional) Exclude the members and repositories of the team from the returned result. Defaults to false.
resultsPerPage Integer
(Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to 100.
rootTeamsOnly Boolean
(Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
summaryOnly Boolean
(Optional) Exclude the members and repositories of the team from the returned result. Defaults to false.
resultsPerPage number
(Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to 100.
rootTeamsOnly boolean
(Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
summaryOnly boolean
(Optional) Exclude the members and repositories of the team from the returned result. Defaults to false.
results_per_page int
(Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to 100.
root_teams_only bool
(Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
summary_only bool
(Optional) Exclude the members and repositories of the team from the returned result. Defaults to false.
resultsPerPage Number
(Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to 100.
rootTeamsOnly Boolean
(Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
summaryOnly Boolean
(Optional) Exclude the members and repositories of the team from the returned result. Defaults to false.

getOrganizationTeams Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Teams List<GetOrganizationTeamsTeam>
(Required) An Array of GitHub Teams. Each team block consists of the fields documented below.
ResultsPerPage int
(Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to 100.
RootTeamsOnly bool
(Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
SummaryOnly bool
(Optional) Exclude the members and repositories of the team from the returned result. Defaults to false.
Id string
The provider-assigned unique ID for this managed resource.
Teams []GetOrganizationTeamsTeam
(Required) An Array of GitHub Teams. Each team block consists of the fields documented below.
ResultsPerPage int
(Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to 100.
RootTeamsOnly bool
(Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
SummaryOnly bool
(Optional) Exclude the members and repositories of the team from the returned result. Defaults to false.
id String
The provider-assigned unique ID for this managed resource.
teams List<GetOrganizationTeamsTeam>
(Required) An Array of GitHub Teams. Each team block consists of the fields documented below.
resultsPerPage Integer
(Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to 100.
rootTeamsOnly Boolean
(Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
summaryOnly Boolean
(Optional) Exclude the members and repositories of the team from the returned result. Defaults to false.
id string
The provider-assigned unique ID for this managed resource.
teams GetOrganizationTeamsTeam[]
(Required) An Array of GitHub Teams. Each team block consists of the fields documented below.
resultsPerPage number
(Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to 100.
rootTeamsOnly boolean
(Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
summaryOnly boolean
(Optional) Exclude the members and repositories of the team from the returned result. Defaults to false.
id str
The provider-assigned unique ID for this managed resource.
teams Sequence[GetOrganizationTeamsTeam]
(Required) An Array of GitHub Teams. Each team block consists of the fields documented below.
results_per_page int
(Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to 100.
root_teams_only bool
(Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
summary_only bool
(Optional) Exclude the members and repositories of the team from the returned result. Defaults to false.
id String
The provider-assigned unique ID for this managed resource.
teams List<Property Map>
(Required) An Array of GitHub Teams. Each team block consists of the fields documented below.
resultsPerPage Number
(Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to 100.
rootTeamsOnly Boolean
(Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
summaryOnly Boolean
(Optional) Exclude the members and repositories of the team from the returned result. Defaults to false.

Supporting Types

GetOrganizationTeamsTeam

Description This property is required. string
the team's description.
Id This property is required. int
the ID of the team.
Members This property is required. List<string>
List of team members. Not returned if summary_only = true
Name This property is required. string
the team's full name.
NodeId This property is required. string
the Node ID of the team.
Parent This property is required. Dictionary<string, string>
the parent team.
Privacy This property is required. string
the team's privacy type.
Repositories This property is required. List<string>
List of team repositories. Not returned if summary_only = true
Slug This property is required. string
the slug of the team.
Description This property is required. string
the team's description.
Id This property is required. int
the ID of the team.
Members This property is required. []string
List of team members. Not returned if summary_only = true
Name This property is required. string
the team's full name.
NodeId This property is required. string
the Node ID of the team.
Parent This property is required. map[string]string
the parent team.
Privacy This property is required. string
the team's privacy type.
Repositories This property is required. []string
List of team repositories. Not returned if summary_only = true
Slug This property is required. string
the slug of the team.
description This property is required. String
the team's description.
id This property is required. Integer
the ID of the team.
members This property is required. List<String>
List of team members. Not returned if summary_only = true
name This property is required. String
the team's full name.
nodeId This property is required. String
the Node ID of the team.
parent This property is required. Map<String,String>
the parent team.
privacy This property is required. String
the team's privacy type.
repositories This property is required. List<String>
List of team repositories. Not returned if summary_only = true
slug This property is required. String
the slug of the team.
description This property is required. string
the team's description.
id This property is required. number
the ID of the team.
members This property is required. string[]
List of team members. Not returned if summary_only = true
name This property is required. string
the team's full name.
nodeId This property is required. string
the Node ID of the team.
parent This property is required. {[key: string]: string}
the parent team.
privacy This property is required. string
the team's privacy type.
repositories This property is required. string[]
List of team repositories. Not returned if summary_only = true
slug This property is required. string
the slug of the team.
description This property is required. str
the team's description.
id This property is required. int
the ID of the team.
members This property is required. Sequence[str]
List of team members. Not returned if summary_only = true
name This property is required. str
the team's full name.
node_id This property is required. str
the Node ID of the team.
parent This property is required. Mapping[str, str]
the parent team.
privacy This property is required. str
the team's privacy type.
repositories This property is required. Sequence[str]
List of team repositories. Not returned if summary_only = true
slug This property is required. str
the slug of the team.
description This property is required. String
the team's description.
id This property is required. Number
the ID of the team.
members This property is required. List<String>
List of team members. Not returned if summary_only = true
name This property is required. String
the team's full name.
nodeId This property is required. String
the Node ID of the team.
parent This property is required. Map<String>
the parent team.
privacy This property is required. String
the team's privacy type.
repositories This property is required. List<String>
List of team repositories. Not returned if summary_only = true
slug This property is required. String
the slug of the team.

Package Details

Repository
GitHub pulumi/pulumi-github
License
Apache-2.0
Notes
This Pulumi package is based on the github Terraform Provider.