github.getBranchProtectionRules

Explore with Pulumi AI

Use this data source to retrieve a list of repository branch protection rules.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;

return await Deployment.RunAsync(() => 
{
    var example = Github.GetBranchProtectionRules.Invoke(new()
    {
        Repository = "example",
    });

});
package main

import (
	"github.com/pulumi/pulumi-github/sdk/v5/go/github"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := github.GetBranchProtectionRules(ctx, &github.GetBranchProtectionRulesArgs{
			Repository: "example",
		}, nil)
		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.GithubFunctions;
import com.pulumi.github.inputs.GetBranchProtectionRulesArgs;
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.getBranchProtectionRules(GetBranchProtectionRulesArgs.builder()
            .repository("example")
            .build());

    }
}
import pulumi
import pulumi_github as github

example = github.get_branch_protection_rules(repository="example")
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";

const example = github.getBranchProtectionRules({
    repository: "example",
});
variables:
  example:
    fn::invoke:
      Function: github:getBranchProtectionRules
      Arguments:
        repository: example

Using getBranchProtectionRules

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 getBranchProtectionRules(args: GetBranchProtectionRulesArgs, opts?: InvokeOptions): Promise<GetBranchProtectionRulesResult>
function getBranchProtectionRulesOutput(args: GetBranchProtectionRulesOutputArgs, opts?: InvokeOptions): Output<GetBranchProtectionRulesResult>
def get_branch_protection_rules(repository: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetBranchProtectionRulesResult
def get_branch_protection_rules_output(repository: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetBranchProtectionRulesResult]
func GetBranchProtectionRules(ctx *Context, args *GetBranchProtectionRulesArgs, opts ...InvokeOption) (*GetBranchProtectionRulesResult, error)
func GetBranchProtectionRulesOutput(ctx *Context, args *GetBranchProtectionRulesOutputArgs, opts ...InvokeOption) GetBranchProtectionRulesResultOutput

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

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

The following arguments are supported:

Repository string

The GitHub repository name.

Repository string

The GitHub repository name.

repository String

The GitHub repository name.

repository string

The GitHub repository name.

repository str

The GitHub repository name.

repository String

The GitHub repository name.

getBranchProtectionRules Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Repository string
Rules List<GetBranchProtectionRulesRule>

Collection of Branch Protection Rules. Each of the results conforms to the following scheme:

Id string

The provider-assigned unique ID for this managed resource.

Repository string
Rules []GetBranchProtectionRulesRule

Collection of Branch Protection Rules. Each of the results conforms to the following scheme:

id String

The provider-assigned unique ID for this managed resource.

repository String
rules List<GetBranchProtectionRulesRule>

Collection of Branch Protection Rules. Each of the results conforms to the following scheme:

id string

The provider-assigned unique ID for this managed resource.

repository string
rules GetBranchProtectionRulesRule[]

Collection of Branch Protection Rules. Each of the results conforms to the following scheme:

id str

The provider-assigned unique ID for this managed resource.

repository str
rules Sequence[GetBranchProtectionRulesRule]

Collection of Branch Protection Rules. Each of the results conforms to the following scheme:

id String

The provider-assigned unique ID for this managed resource.

repository String
rules List<Property Map>

Collection of Branch Protection Rules. Each of the results conforms to the following scheme:

Supporting Types

GetBranchProtectionRulesRule

Pattern string

Identifies the protection rule pattern.

Pattern string

Identifies the protection rule pattern.

pattern String

Identifies the protection rule pattern.

pattern string

Identifies the protection rule pattern.

pattern str

Identifies the protection rule pattern.

pattern String

Identifies the protection rule pattern.

Package Details

Repository
GitHub pulumi/pulumi-github
License
Apache-2.0
Notes

This Pulumi package is based on the github Terraform Provider.