Octokit.Webhooks.AspNetCore 2.4.1

Prefix Reserved
dotnet add package Octokit.Webhooks.AspNetCore --version 2.4.1                
NuGet\Install-Package Octokit.Webhooks.AspNetCore -Version 2.4.1                
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="Octokit.Webhooks.AspNetCore" Version="2.4.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Octokit.Webhooks.AspNetCore --version 2.4.1                
#r "nuget: Octokit.Webhooks.AspNetCore, 2.4.1"                
#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.
// Install Octokit.Webhooks.AspNetCore as a Cake Addin
#addin nuget:?package=Octokit.Webhooks.AspNetCore&version=2.4.1

// Install Octokit.Webhooks.AspNetCore as a Cake Tool
#tool nuget:?package=Octokit.Webhooks.AspNetCore&version=2.4.1                

Octokit.Webhooks

GitHub Workflow Status Octokit.Webhooks NuGet Package Version Octokit.Webhooks NuGet Package Downloads OpenSSF Scorecard

Libraries to handle GitHub Webhooks in .NET applications.

Usage

ASP.NET Core

  1. dotnet add package Octokit.Webhooks.AspNetCore

  2. Create a class that derives from WebhookEventProcessor and override any of the virtual methods to handle webhooks from GitHub. For example, to handle Pull Request webhooks:

    public sealed class MyWebhookEventProcessor : WebhookEventProcessor
    {
        protected override Task ProcessPullRequestWebhookAsync(WebhookHeaders headers, PullRequestEvent pullRequestEvent, PullRequestAction action) 
        {
            ...
        }
    }
    
  3. Register your implementation of WebhookEventProcessor:

    builder.Services.AddSingleton<WebhookEventProcessor, MyWebhookEventProcessor>();
    
  4. Map the webhook endpoint:

    app.UseEndpoints(endpoints =>
    {
        ...
        endpoints.MapGitHubWebhooks();
        ...
    });
    

MapGitHubWebhooks() takes two optional parameters:

  • path. Defaults to /api/github/webhooks, the URL of the endpoint to use for GitHub.
  • secret. The secret you have configured in GitHub, if you have set this up.

Azure Functions

NOTE: Support is only provided for isolated process Azure Functions.

  1. dotnet add package Octokit.Webhooks.AzureFunctions

  2. Create a class that derives from WebhookEventProcessor and override any of the virtual methods to handle webhooks from GitHub. For example, to handle Pull Request webhooks:

    public sealed class MyWebhookEventProcessor : WebhookEventProcessor
    {
        protected override Task ProcessPullRequestWebhookAsync(WebhookHeaders headers, PullRequestEvent pullRequestEvent, PullRequestAction action) 
        {
            ...
        }
    }
    
  3. Register your implementation of WebhookEventProcessor:

    .ConfigureServices(collection =>
    {
        ...
        collection.AddSingleton<WebhookEventProcessor, MyWebhookEventProcessor>();
        ...
    })
    
  4. Configure the webhook function:

    new HostBuilder()
    ...
    .ConfigureGitHubWebhooks()
    ...
    .Build();
    

ConfigureGitHubWebhooks() either takes an optional parameter:

  • secret. The secret you have configured in GitHub, if you have set this up.

or:

  • configure. A function that takes an IConfiguration instance and expects the secret you have configured in GitHub in return.

The function is available on the /api/github/webhooks endpoint.

Thanks

License

All packages in this repository are licensed under the MIT license.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.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 Octokit.Webhooks.AspNetCore:

Package Downloads
MintPlayer.SlingBot

Build a Github Bot

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Octokit.Webhooks.AspNetCore:

Repository Stars
microsoft/project-oagents
Experimental AI Agents Framework
Version Downloads Last updated
2.4.1 5,236 10/22/2024
2.4.0 4,959 10/9/2024
2.3.0 1,183 10/2/2024
2.2.3 6,501 7/31/2024
2.2.2 5,166 6/27/2024
2.2.1 6,848 5/9/2024
2.2.0 550 5/6/2024
2.1.1 7,131 2/29/2024
2.1.0 5,192 12/19/2023
2.0.6 5,627 11/12/2023
2.0.5 1,998 10/26/2023
2.0.4 1,622 10/12/2023
2.0.3 6,440 8/25/2023
2.0.2 2,010 8/16/2023
2.0.1 2,463 6/13/2023
2.0.0 324 6/9/2023
1.5.2 3,239 6/1/2023
1.5.1 1,429 4/27/2023
1.5.0 382 4/25/2023
1.4.1 582 4/11/2023
1.4.0 222 4/6/2023
1.3.5 14,005 10/13/2022
1.3.4 321 10/5/2022
1.3.3 8,456 8/11/2022
1.3.2 207 8/9/2022
1.3.1 922 7/20/2022
1.3.0 169 7/19/2022
1.2.1 3,700 7/7/2022
1.2.0 191 7/7/2022
1.1.1 774 6/27/2022
1.1.0 353 6/13/2022
1.0.0 1,632 5/13/2022
0.6.5 542 4/27/2022
0.6.4 339 4/13/2022
0.6.3 2,180 3/31/2022
0.6.2 273 3/26/2022
0.6.1 205 3/25/2022
0.6.0 266 2/2/2022
0.5.0 736 1/24/2022
0.4.0 529 1/13/2022
0.3.0 5,994 11/23/2021
0.2.0 198 10/29/2021
0.1.2 272 9/27/2021
0.1.1 628 9/21/2021