Git Repository Public Repository

CPE_learningsite

URLs

Copy to Clipboard

This repository has no backups
This repository's network speed is throttled to 100KB/sec

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44




using Microsoft.AspNet.WebHooks;
using Newtonsoft.Json.Linq;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

namespace CPE.App.Api.WebHooks
{
    public class GitHubWebHookHandler : WebHookHandler
    {
        public GitHubWebHookHandler()
        {
            this.Receiver = "github";
        }

        public override Task ExecuteAsync(string receiver, WebHookHandlerContext context)
        {
            string action = context.Actions.First();
            JObject data = context.GetDataOrDefault<JObject>();

            Debug.WriteLine("Made it to reciever");
            TextWriter writer = null;
            try
            {
                var contentsToWriteToFile = data;
                writer = new StreamWriter("C:/bitbucket/githubWebhookdata.txt", false);
                writer.Write(contentsToWriteToFile);
            }
            finally
            {
                if (writer != null)
                    writer.Close();
            }
            
            return Task.FromResult(true);
        }
    }
}

Commits for CPE_learningsite/CPE/CPE.App/CPE.App.Api/WebHooks/GitHubWebHookHandler.cs

Diff revisions: vs.
Revision Author Commited Message
4cd176 ... v.shishlov Fri 27 Aug, 2021 14:33:17 +0000

initial commit