Viewing docs for GitHub v6.12.1
published on Thursday, Feb 12, 2026 by Pulumi
published on Thursday, Feb 12, 2026 by Pulumi
Viewing docs for GitHub v6.12.1
published on Thursday, Feb 12, 2026 by Pulumi
published on Thursday, Feb 12, 2026 by Pulumi
Use this data source to retrieve a list of repository branch protection rules.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const example = github.getBranchProtectionRules({
repository: "example",
});
import pulumi
import pulumi_github as github
example = github.get_branch_protection_rules(repository="example")
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.GetBranchProtectionRules(ctx, &github.GetBranchProtectionRulesArgs{
Repository: "example",
}, 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.GetBranchProtectionRules.Invoke(new()
{
Repository = "example",
});
});
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());
}
}
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)
public static Output<GetBranchProtectionRulesResult> getBranchProtectionRules(GetBranchProtectionRulesArgs args, InvokeOptions options)
fn::invoke:
function: github:index/getBranchProtectionRules:getBranchProtectionRules
arguments:
# arguments dictionaryThe 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<Get
Branch Protection Rules Rule> - 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
[]Get
Branch Protection Rules Rule - 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<Get
Branch Protection Rules Rule> - 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
Get
Branch Protection Rules Rule[] - 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[Get
Branch Protection Rules Rule] - 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
githubTerraform Provider.
Viewing docs for GitHub v6.12.1
published on Thursday, Feb 12, 2026 by Pulumi
published on Thursday, Feb 12, 2026 by Pulumi
