Repository Environment
This resource allows you to create and manage environments for a GitHub repository.
Example Usage
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.GetUserArgs;
import com.pulumi.github.Repository;
import com.pulumi.github.RepositoryArgs;
import com.pulumi.github.RepositoryEnvironment;
import com.pulumi.github.RepositoryEnvironmentArgs;
import com.pulumi.github.inputs.RepositoryEnvironmentReviewerArgs;
import com.pulumi.github.inputs.RepositoryEnvironmentDeploymentBranchPolicyArgs;
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 current = GithubFunctions.getUser(GetUserArgs.builder()
.username("")
.build());
var exampleRepository = new Repository("exampleRepository", RepositoryArgs.builder()
.description("My awesome codebase")
.build());
var exampleRepositoryEnvironment = new RepositoryEnvironment("exampleRepositoryEnvironment", RepositoryEnvironmentArgs.builder()
.environment("example")
.repository(exampleRepository.name())
.reviewers(RepositoryEnvironmentReviewerArgs.builder()
.users(current.applyValue(getUserResult -> getUserResult.id()))
.build())
.deploymentBranchPolicy(RepositoryEnvironmentDeploymentBranchPolicyArgs.builder()
.protectedBranches(true)
.customBranchPolicies(false)
.build())
.build());
}
}
Content copied to clipboard
Import
GitHub Repository Environment can be imported using an ID made up of name
of the repository combined with the environment
name of the environment, separated by a :
character, e.g.
$ pulumi import github:index/repositoryEnvironment:RepositoryEnvironment daily terraform:daily
Content copied to clipboard
Properties
Link copied to clipboard
Can repository admins bypass the environment protections. Defaults to true
.
Link copied to clipboard
The deployment branch policy configuration
Link copied to clipboard
The name of the environment.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
The repository of the environment.
Link copied to clipboard
The environment reviewers configuration.