TeamRepository

class TeamRepository : KotlinCustomResource

Note: github.TeamRepository cannot be used in conjunction with github.RepositoryCollaborators or they will fight over what your policy should be. This resource manages relationships between teams and repositories in your GitHub organization. Creating this resource grants a particular team permissions on a particular repository. The repository and the team must both belong to the same organization on GitHub. This resource does not actually create any repositories; to do that, see github.Repository. This resource is non-authoritative, for managing ALL collaborators of a repo, use github.RepositoryCollaborators instead.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
// Add a repository to the team
const someTeam = new github.Team("some_team", {
name: "SomeTeam",
description: "Some cool team",
});
const someRepo = new github.Repository("some_repo", {name: "some-repo"});
const someTeamRepo = new github.TeamRepository("some_team_repo", {
teamId: someTeam.id,
repository: someRepo.name,
permission: "pull",
});
import pulumi
import pulumi_github as github
# Add a repository to the team
some_team = github.Team("some_team",
name="SomeTeam",
description="Some cool team")
some_repo = github.Repository("some_repo", name="some-repo")
some_team_repo = github.TeamRepository("some_team_repo",
team_id=some_team.id,
repository=some_repo.name,
permission="pull")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
// Add a repository to the team
var someTeam = new Github.Team("some_team", new()
{
Name = "SomeTeam",
Description = "Some cool team",
});
var someRepo = new Github.Repository("some_repo", new()
{
Name = "some-repo",
});
var someTeamRepo = new Github.TeamRepository("some_team_repo", new()
{
TeamId = someTeam.Id,
Repository = someRepo.Name,
Permission = "pull",
});
});
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 {
// Add a repository to the team
someTeam, err := github.NewTeam(ctx, "some_team", &github.TeamArgs{
Name: pulumi.String("SomeTeam"),
Description: pulumi.String("Some cool team"),
})
if err != nil {
return err
}
someRepo, err := github.NewRepository(ctx, "some_repo", &github.RepositoryArgs{
Name: pulumi.String("some-repo"),
})
if err != nil {
return err
}
_, err = github.NewTeamRepository(ctx, "some_team_repo", &github.TeamRepositoryArgs{
TeamId: someTeam.ID(),
Repository: someRepo.Name,
Permission: pulumi.String("pull"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.Team;
import com.pulumi.github.TeamArgs;
import com.pulumi.github.Repository;
import com.pulumi.github.RepositoryArgs;
import com.pulumi.github.TeamRepository;
import com.pulumi.github.TeamRepositoryArgs;
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) {
// Add a repository to the team
var someTeam = new Team("someTeam", TeamArgs.builder()
.name("SomeTeam")
.description("Some cool team")
.build());
var someRepo = new Repository("someRepo", RepositoryArgs.builder()
.name("some-repo")
.build());
var someTeamRepo = new TeamRepository("someTeamRepo", TeamRepositoryArgs.builder()
.teamId(someTeam.id())
.repository(someRepo.name())
.permission("pull")
.build());
}
}
resources:
# Add a repository to the team
someTeam:
type: github:Team
name: some_team
properties:
name: SomeTeam
description: Some cool team
someRepo:
type: github:Repository
name: some_repo
properties:
name: some-repo
someTeamRepo:
type: github:TeamRepository
name: some_team_repo
properties:
teamId: ${someTeam.id}
repository: ${someRepo.name}
permission: pull

Import

GitHub Team Repository can be imported using an ID made up of team_id:repository or team_name:repository, e.g.

$ pulumi import github:index/teamRepository:TeamRepository terraform_repo 1234567:terraform
$ pulumi import github:index/teamRepository:TeamRepository terraform_repo Administrators:terraform

Properties

Link copied to clipboard
val etag: Output<String>
Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val permission: Output<String>?

The permissions of team members regarding the repository. Must be one of pull, triage, push, maintain, admin or the name of an existing custom repository role within the organisation. Defaults to pull.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val repository: Output<String>

The repository to add to the team.

Link copied to clipboard
val teamId: Output<String>

The GitHub team id or the GitHub team slug

Link copied to clipboard
val urn: Output<String>