Soenneker.GitHub.Repositories.Rulesets 4.0.1702

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.GitHub.Repositories.Rulesets --version 4.0.1702
                    
NuGet\Install-Package Soenneker.GitHub.Repositories.Rulesets -Version 4.0.1702
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.GitHub.Repositories.Rulesets" Version="4.0.1702" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.GitHub.Repositories.Rulesets" Version="4.0.1702" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.GitHub.Repositories.Rulesets" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.GitHub.Repositories.Rulesets --version 4.0.1702
                    
#r "nuget: Soenneker.GitHub.Repositories.Rulesets, 4.0.1702"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.GitHub.Repositories.Rulesets@4.0.1702
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.GitHub.Repositories.Rulesets&version=4.0.1702
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.GitHub.Repositories.Rulesets&version=4.0.1702
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.GitHub.Repositories.Rulesets

Create, inspect, and remove repository-level GitHub rulesets for branches, tags, or pushes.

Installation

dotnet add package Soenneker.GitHub.Repositories.Rulesets

Configuration

{
  "GH": {
    "Token": "github-token"
  }
}

The token needs repository administration permission to create or delete rulesets.

Registration

services.AddGitHubRepositoriesRulesetsUtilAsSingleton();

Use AddGitHubRepositoriesRulesetsUtilAsScoped() for a scoped consumer.

Create a ruleset

var ruleset = new RepositoryRuleset
{
    Name = "Protect main",
    Target = TargetEnum.Branch,
    Enforcement = EnforcementEnum.Active,
    Conditions = new Conditions
    {
        RefName = new RefNameCondition
        {
            Include = ["refs/heads/main"]
        }
    },
    Rules =
    [
        new Rule { Type = "deletion" },
        new Rule { Type = "non_fast_forward" }
    ]
};

await rulesets.Add(
    "soenneker",
    "example-repository",
    ruleset,
    cancellationToken);

RepositoryRuleset maps directly to GitHub's ruleset request shape. Rule types and their Parameters must be valid for the selected target.

List or delete rulesets

List<RepositoryRuleset> existing = await rulesets.GetAll(
    "soenneker",
    "example-repository",
    cancellationToken);

await rulesets.Delete(
    "soenneker",
    "example-repository",
    rulesetId,
    cancellationToken);

GetAll follows pagination and returns all visible repository rulesets. DeleteAll permanently removes every ruleset returned for the repository; it does not preserve or recreate their policies.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.GitHub.Repositories.Rulesets:

Package Downloads
Soenneker.GitHub.Repositories.Suite

Registers commonly used Soenneker GitHub repository services through one package

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.1779 109 11/19/2026
11.0.1778 52 11/19/2026
11.0.1777 44 11/19/2026
11.0.1776 61 11/19/2026
11.0.1775 53 11/19/2026
11.0.1774 50 11/18/2026
11.0.1773 51 11/18/2026
11.0.1772 46 11/18/2026
11.0.1771 64 11/18/2026
11.0.1767 72 11/18/2026
11.0.1766 258 11/15/2026
11.0.1765 108 11/15/2026
11.0.1764 111 11/15/2026
11.0.1763 162 11/15/2026
11.0.1762 92 11/14/2026
11.0.1761 427 11/11/2026
11.0.1760 104 11/11/2026
11.0.1759 111 11/11/2026
11.0.1758 106 11/11/2026
4.0.1702 109 10/15/2026
Loading failed

Updated Multiple NuGet packages