File tree Expand file tree Collapse file tree 4 files changed +43
-763
lines changed
Expand file tree Collapse file tree 4 files changed +43
-763
lines changed Original file line number Diff line number Diff line change @@ -4,5 +4,5 @@ branding:
44 icon : ' alert-octagon'
55 color : ' green'
66runs :
7- using : ' docker '
8- image : ' Dockerfile '
7+ using : ' node12 '
8+ image : ' main.js '
Original file line number Diff line number Diff line change 1- const request = require ( "request " ) ;
1+ const axios = require ( "axios " ) ;
22const crypto = require ( "crypto" ) ;
33
44const hmacSecret = process . env . HMAC_SECRET ;
@@ -36,30 +36,19 @@ const data = {
3636 : process . env . REQUEST_DATA
3737} ;
3838
39- const signature = createHmacSignature ( data ) ;
40-
41- request (
42- {
43- method : "POST" ,
44- uri : uri ,
4539
46- json : true ,
47- body : data ,
48- headers : {
49- "X-Hub-Signature" : signature ,
50- "X-Hub-SHA" : process . env . GITHUB_SHA
51- }
52- } ,
53- ( error , response , body ) => {
54- if ( error || response . statusCode < 200 || response . statusCode > 299 ) {
55- // Something went wrong
56- console . error ( `Request failed with status code ${ response . statusCode } !` ) ;
57- console . error ( response . body ) ;
40+ const signature = createHmacSignature ( data ) ;
5841
59- process . exit ( 1 ) ;
60- } else {
61- // Success
62- process . exit ( ) ;
63- }
42+ axios . post ( uri , data , {
43+ headers : {
44+ "X-Hub-Signature" : signature ,
45+ "X-Hub-SHA" : process . env . GITHUB_SHA
6446 }
65- ) ;
47+ } ) . then ( function ( response ) {
48+ process . exit ( ) ;
49+ } ) . catch ( function ( error ) {
50+ console . error ( `Request failed with status code ${ error . response . status } !` ) ;
51+ console . error ( error . response . data ) ;
52+
53+ process . exit ( 1 ) ;
54+ } ) ;
You can’t perform that action at this time.
0 commit comments