Soenneker.GitHub.Repositories.Rulesets 4.0.1682

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.1682
                    
NuGet\Install-Package Soenneker.GitHub.Repositories.Rulesets -Version 4.0.1682
                    
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.1682" />
                    
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.1682" />
                    
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.1682
                    
#r "nuget: Soenneker.GitHub.Repositories.Rulesets, 4.0.1682"
                    
#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.1682
                    
#: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.1682
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.GitHub.Repositories.Rulesets&version=4.0.1682
                    
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 57 11/19/2026
11.0.1778 48 11/19/2026
11.0.1777 42 11/19/2026
11.0.1776 56 11/19/2026
11.0.1775 50 11/19/2026
11.0.1774 47 11/18/2026
11.0.1773 48 11/18/2026
11.0.1772 45 11/18/2026
11.0.1771 60 11/18/2026
11.0.1767 70 11/18/2026
11.0.1766 246 11/15/2026
11.0.1765 108 11/15/2026
11.0.1764 106 11/15/2026
11.0.1763 155 11/15/2026
11.0.1762 92 11/14/2026
11.0.1761 417 11/11/2026
11.0.1760 103 11/11/2026
11.0.1759 111 11/11/2026
11.0.1758 105 11/11/2026
4.0.1682 114 10/13/2026
Loading failed

Update nuget-resilient-login to v3