Octokit.Webhooks.AzureFunctions 2.1.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
This package has a SemVer 2.0.0 package version: 2.1.0+build.1101.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Octokit.Webhooks.AzureFunctions --version 2.1.0
NuGet\Install-Package Octokit.Webhooks.AzureFunctions -Version 2.1.0
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.AzureFunctions" Version="2.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Octokit.Webhooks.AzureFunctions --version 2.1.0
#r "nuget: Octokit.Webhooks.AzureFunctions, 2.1.0"
#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.AzureFunctions as a Cake Addin
#addin nuget:?package=Octokit.Webhooks.AzureFunctions&version=2.1.0

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

Octokit.Webhooks

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

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() takes one optional parameter:

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

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.1 69 2/29/2024
2.1.0 180 12/19/2023
2.0.6 103 11/12/2023
2.0.5 83 10/26/2023
2.0.4 327 10/12/2023
2.0.3 1,210 8/25/2023
2.0.2 297 8/16/2023
2.0.1 163 6/13/2023
2.0.0 82 6/9/2023
1.5.2 92 6/1/2023
1.5.1 111 4/27/2023
1.5.0 88 4/25/2023
1.4.1 100 4/11/2023
1.4.0 86 4/6/2023
1.3.5 144 10/13/2022
1.3.4 82 10/5/2022
1.3.3 126 8/11/2022
1.3.2 114 8/9/2022