BranchArgs

data class BranchArgs(val branch: Output<String>? = null, val repository: Output<String>? = null, val sourceBranch: Output<String>? = null, val sourceSha: Output<String>? = null) : ConvertibleToJava<BranchArgs>

This resource allows you to create and manage branches within your repository. Additional constraints can be applied to ensure your branch is created from another branch or commit.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const development = new github.Branch("development", {
repository: "example",
branch: "development",
});
import pulumi
import pulumi_github as github
development = github.Branch("development",
repository="example",
branch="development")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var development = new Github.Branch("development", new()
{
Repository = "example",
BranchName = "development",
});
});
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.NewBranch(ctx, "development", &github.BranchArgs{
Repository: pulumi.String("example"),
Branch: pulumi.String("development"),
})
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.Branch;
import com.pulumi.github.BranchArgs;
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 development = new Branch("development", BranchArgs.builder()
.repository("example")
.branch("development")
.build());
}
}
resources:
development:
type: github:Branch
properties:
repository: example
branch: development

Import

GitHub Branch can be imported using an ID made up of repository:branch, e.g.

$ pulumi import github:index/branch:Branch terraform terraform:main

Importing github branch into an instance object (when using a for each block to manage multiple branches)

$ pulumi import github:index/branch:Branch terraform["terraform"] terraform:main

Optionally, a source branch may be specified using an ID of repository:branch:source_branch. This is useful for importing branches that do not branch directly off main.

$ pulumi import github:index/branch:Branch terraform terraform:feature-branch:dev

Constructors

Link copied to clipboard
constructor(branch: Output<String>? = null, repository: Output<String>? = null, sourceBranch: Output<String>? = null, sourceSha: Output<String>? = null)

Properties

Link copied to clipboard
val branch: Output<String>? = null

The repository branch to create.

Link copied to clipboard
val repository: Output<String>? = null

The GitHub repository name.

Link copied to clipboard
val sourceBranch: Output<String>? = null

The branch name to start from. Defaults to main.

Link copied to clipboard
val sourceSha: Output<String>? = null

The commit hash to start from. Defaults to the tip of source_branch. If provided, source_branch is ignored.

Functions

Link copied to clipboard
open override fun toJava(): BranchArgs