File tree Expand file tree Collapse file tree 3 files changed +98
-113
lines changed Expand file tree Collapse file tree 3 files changed +98
-113
lines changed Original file line number Diff line number Diff line change 1
- const { createProbot } = require ( "probot" ) ;
1
+ const {
2
+ createProbot,
3
+ createAzureFunction,
4
+ } = require ( "@probot/adapter-azure-functions" ) ;
2
5
const app = require ( "../app" ) ;
3
6
4
- // create Probot instance using environment variables
5
- const probot = createProbot ( ) ;
6
-
7
- // load app once outside of the function to prevent double
8
- // event handlers in case of container reuse
9
- probot . load ( app ) ;
10
-
11
- /**
12
- * @param {import('@azure/functions').Context } context
13
- * @param {import('@azure/functions').HttpRequest } req
14
- */
15
- module . exports = async function ( context , req ) {
16
- // this will be simpler once we ship `verifyAndParse()`
17
- // see https://github.com/octokit/webhooks.js/issues/379
18
- await probot . webhooks . verifyAndReceive ( {
19
- id : req . headers [ "X-GitHub-Delivery" ] || req . headers [ "x-github-delivery" ] ,
20
- name : req . headers [ "X-GitHub-Event" ] || req . headers [ "x-github-event" ] ,
21
- signature :
22
- req . headers [ "X-Hub-Signature-256" ] || req . headers [ "x-hub-signature-256" ] ,
23
- payload : req . body ,
24
- } ) ;
25
-
26
- context . res = {
27
- status : "200" ,
28
- body : "ok" ,
29
- } ;
30
- } ;
7
+ module . exports = createAzureFunction ( app , { probot : createProbot ( ) } ) ;
Original file line number Diff line number Diff line change 11
11
"license" : " ISC" ,
12
12
"repository" : " https://github.com/probot/example-azure-function" ,
13
13
"dependencies" : {
14
- "probot" : " ^11 .0.6 "
14
+ "@ probot/adapter-azure-functions " : " ^1 .0.0 "
15
15
},
16
16
"devDependencies" : {
17
17
"@azure/functions" : " ^1.2.3" ,
You can’t perform that action at this time.
0 commit comments