1. Packages
  2. GitHub
  3. API Docs
  4. getRepositoryBranches
GitHub v6.3.0 published on Monday, Sep 16, 2024 by Pulumi

github.getRepositoryBranches

Explore with Pulumi AI

github logo
GitHub v6.3.0 published on Monday, Sep 16, 2024 by Pulumi

    Use this data source to retrieve information about branches in a repository.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    const example = github.getRepositoryBranches({
        repository: "example-repository",
    });
    
    import pulumi
    import pulumi_github as github
    
    example = github.get_repository_branches(repository="example-repository")
    
    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.GetRepositoryBranches(ctx, &github.GetRepositoryBranchesArgs{
    			Repository: "example-repository",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Github.GetRepositoryBranches.Invoke(new()
        {
            Repository = "example-repository",
        });
    
    });
    
    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.GetRepositoryBranchesArgs;
    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 example = GithubFunctions.getRepositoryBranches(GetRepositoryBranchesArgs.builder()
                .repository("example-repository")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: github:getRepositoryBranches
          Arguments:
            repository: example-repository
    

    Using getRepositoryBranches

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getRepositoryBranches(args: GetRepositoryBranchesArgs, opts?: InvokeOptions): Promise<GetRepositoryBranchesResult>
    function getRepositoryBranchesOutput(args: GetRepositoryBranchesOutputArgs, opts?: InvokeOptions): Output<GetRepositoryBranchesResult>
    def get_repository_branches(only_non_protected_branches: Optional[bool] = None,
                                only_protected_branches: Optional[bool] = None,
                                repository: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetRepositoryBranchesResult
    def get_repository_branches_output(only_non_protected_branches: Optional[pulumi.Input[bool]] = None,
                                only_protected_branches: Optional[pulumi.Input[bool]] = None,
                                repository: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetRepositoryBranchesResult]
    func GetRepositoryBranches(ctx *Context, args *GetRepositoryBranchesArgs, opts ...InvokeOption) (*GetRepositoryBranchesResult, error)
    func GetRepositoryBranchesOutput(ctx *Context, args *GetRepositoryBranchesOutputArgs, opts ...InvokeOption) GetRepositoryBranchesResultOutput

    > Note: This function is named GetRepositoryBranches in the Go SDK.

    public static class GetRepositoryBranches 
    {
        public static Task<GetRepositoryBranchesResult> InvokeAsync(GetRepositoryBranchesArgs args, InvokeOptions? opts = null)
        public static Output<GetRepositoryBranchesResult> Invoke(GetRepositoryBranchesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRepositoryBranchesResult> getRepositoryBranches(GetRepositoryBranchesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: github:index/getRepositoryBranches:getRepositoryBranches
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Repository string
    Name of the repository to retrieve the branches from.
    OnlyNonProtectedBranches bool
    . If true, the branches attributes will be populated only with non protected branches. Default: false.
    OnlyProtectedBranches bool
    . If true, the branches attributes will be populated only with protected branches. Default: false.
    Repository string
    Name of the repository to retrieve the branches from.
    OnlyNonProtectedBranches bool
    . If true, the branches attributes will be populated only with non protected branches. Default: false.
    OnlyProtectedBranches bool
    . If true, the branches attributes will be populated only with protected branches. Default: false.
    repository String
    Name of the repository to retrieve the branches from.
    onlyNonProtectedBranches Boolean
    . If true, the branches attributes will be populated only with non protected branches. Default: false.
    onlyProtectedBranches Boolean
    . If true, the branches attributes will be populated only with protected branches. Default: false.
    repository string
    Name of the repository to retrieve the branches from.
    onlyNonProtectedBranches boolean
    . If true, the branches attributes will be populated only with non protected branches. Default: false.
    onlyProtectedBranches boolean
    . If true, the branches attributes will be populated only with protected branches. Default: false.
    repository str
    Name of the repository to retrieve the branches from.
    only_non_protected_branches bool
    . If true, the branches attributes will be populated only with non protected branches. Default: false.
    only_protected_branches bool
    . If true, the branches attributes will be populated only with protected branches. Default: false.
    repository String
    Name of the repository to retrieve the branches from.
    onlyNonProtectedBranches Boolean
    . If true, the branches attributes will be populated only with non protected branches. Default: false.
    onlyProtectedBranches Boolean
    . If true, the branches attributes will be populated only with protected branches. Default: false.

    getRepositoryBranches Result

    The following output properties are available:

    Branches List<GetRepositoryBranchesBranch>
    The list of this repository's branches. Each element of branches has the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    Repository string
    OnlyNonProtectedBranches bool
    OnlyProtectedBranches bool
    Branches []GetRepositoryBranchesBranch
    The list of this repository's branches. Each element of branches has the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    Repository string
    OnlyNonProtectedBranches bool
    OnlyProtectedBranches bool
    branches List<GetRepositoryBranchesBranch>
    The list of this repository's branches. Each element of branches has the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    repository String
    onlyNonProtectedBranches Boolean
    onlyProtectedBranches Boolean
    branches GetRepositoryBranchesBranch[]
    The list of this repository's branches. Each element of branches has the following attributes:
    id string
    The provider-assigned unique ID for this managed resource.
    repository string
    onlyNonProtectedBranches boolean
    onlyProtectedBranches boolean
    branches Sequence[GetRepositoryBranchesBranch]
    The list of this repository's branches. Each element of branches has the following attributes:
    id str
    The provider-assigned unique ID for this managed resource.
    repository str
    only_non_protected_branches bool
    only_protected_branches bool
    branches List<Property Map>
    The list of this repository's branches. Each element of branches has the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    repository String
    onlyNonProtectedBranches Boolean
    onlyProtectedBranches Boolean

    Supporting Types

    GetRepositoryBranchesBranch

    Name string
    Name of the branch.
    Protected bool
    Whether the branch is protected.
    Name string
    Name of the branch.
    Protected bool
    Whether the branch is protected.
    name String
    Name of the branch.
    protected_ Boolean
    Whether the branch is protected.
    name string
    Name of the branch.
    protected boolean
    Whether the branch is protected.
    name str
    Name of the branch.
    protected bool
    Whether the branch is protected.
    name String
    Name of the branch.
    protected Boolean
    Whether the branch is protected.

    Package Details

    Repository
    GitHub pulumi/pulumi-github
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the github Terraform Provider.
    github logo
    GitHub v6.3.0 published on Monday, Sep 16, 2024 by Pulumi