Repository Collaborators
Provides a GitHub repository collaborators resource.
Note: github.RepositoryCollaborators cannot be used in conjunction with github.RepositoryCollaborator and github.TeamRepository or they will fight over what your policy should be. This resource allows you to manage all collaborators for repositories in your organization or personal account. For organization repositories, collaborators can have explicit (and differing levels of) read, write, or administrator access to specific repositories, without giving the user full organization membership. For personal repositories, collaborators can only be granted write (implicitly includes read) permission. When applied, an invitation will be sent to the user to become a collaborators on a repository. When destroyed, either the invitation will be cancelled or the collaborators will be removed from the repository. This resource is authoritative. For adding a collaborator to a repo in a non-authoritative manner, use github.RepositoryCollaborator instead. Further documentation on GitHub collaborators:
Adding outside collaborators to repositories in your organization
Converting an organization member to an outside collaborators
Example Usage
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.RepositoryCollaborators;
import com.pulumi.github.RepositoryCollaboratorsArgs;
import com.pulumi.github.inputs.RepositoryCollaboratorsUserArgs;
import com.pulumi.github.inputs.RepositoryCollaboratorsTeamArgs;
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) {
var someTeam = new Team("someTeam", TeamArgs.builder()
.description("Some cool team")
.build());
var someRepo = new Repository("someRepo");
var someRepoCollaborators = new RepositoryCollaborators("someRepoCollaborators", RepositoryCollaboratorsArgs.builder()
.repository(someRepo.name())
.users(RepositoryCollaboratorsUserArgs.builder()
.permission("admin")
.username("SomeUser")
.build())
.teams(RepositoryCollaboratorsTeamArgs.builder()
.permission("pull")
.teamId(someTeam.slug())
.build())
.build());
}
}
Import
GitHub Repository Collaborators can be imported using the name name
, e.g.
$ pulumi import github:index/repositoryCollaborators:RepositoryCollaborators collaborators terraform
Properties
Map of usernames to invitation ID for any users added as part of creation of this resource to be used in github.UserInvitationAccepter
.
The GitHub repository
List of teams
List of users