-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
30 lines (28 loc) · 984 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System.Reflection;
using CI;
using Octokit;
using Octokit.Webhooks;
using Octokit.Webhooks.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddSingleton(
(provider) =>
{
Console.Write("Logging into github application...");
var client = new GitHubClient(
new ProductHeaderValue(
"CI",
Assembly.GetEntryAssembly()!.GetName().Version!.ToString()))
{
Credentials = new Credentials(
builder.Configuration.GetSection("GithubApplicationToken").Value,
AuthenticationType.Bearer)
};
Console.WriteLine(" Done.");
return client;
})
.AddSingleton<WebhookEventProcessor, CIWebhookEventProcessor>();
var app = builder.Build();
app.UseRouting()
.UseEndpoints(endpoints => endpoints.MapGitHubWebhooks());
app.Run();