Branch

class Branch : KotlinCustomResource

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

Properties

Link copied to clipboard
val branch: Output<String>

The repository branch to create.

Link copied to clipboard
val etag: Output<String>

An etag representing the Branch object.

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

A string representing a branch reference, in the form of refs/heads/<branch>.

Link copied to clipboard
val repository: Output<String>

The GitHub repository name.

Link copied to clipboard
val sha: Output<String>

A string storing the reference's HEAD commit's SHA1.

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

The branch name to start from. Defaults to main.

Link copied to clipboard
val sourceSha: Output<String>

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

Link copied to clipboard
val urn: Output<String>