@@ -171,7 +171,7 @@ function processEvent(event, callback) {
171
171
// The installation_repositories event contains information about both additions and removals.
172
172
console . log ( "Valid installation event" ) ;
173
173
174
- logPayloadToS3 ( body , deliveryId ) ; //upload event to S3
174
+ logPayloadToS3 ( githubEventType , body , deliveryId ) ; //upload event to S3
175
175
176
176
path += "workflows/github/install" ;
177
177
postEndpoint ( path , body , deliveryId , ( response ) => {
@@ -207,7 +207,7 @@ function processEvent(event, callback) {
207
207
// A push has been made for some repository (ignore pushes that are deletes)
208
208
if ( ! body . deleted ) {
209
209
console . log ( "Valid push event" ) ;
210
- logPayloadToS3 ( body , deliveryId ) ; //upload event to S3
210
+ logPayloadToS3 ( githubEventType , body , deliveryId ) ; //upload event to S3
211
211
212
212
const repository = body . repository . full_name ;
213
213
const gitReference = body . ref ;
@@ -225,6 +225,7 @@ function processEvent(event, callback) {
225
225
} ) ;
226
226
} else {
227
227
console . log ( "Valid push event (delete)" ) ;
228
+ logPayloadToS3 ( githubEventType , body , deliveryId ) ; //upload event to S3
228
229
const repository = body . repository . full_name ;
229
230
const gitReference = body . ref ;
230
231
const username = body . sender . login ;
@@ -263,7 +264,7 @@ function processEvent(event, callback) {
263
264
}
264
265
}
265
266
266
- function logPayloadToS3 ( body , deliveryId ) {
267
+ function logPayloadToS3 ( eventType , body , deliveryId ) {
267
268
// If bucket name is not null (had to put this for the integration test)
268
269
if ( process . env . BUCKET_NAME ) {
269
270
const date = new Date ( ) ;
@@ -273,10 +274,14 @@ function logPayloadToS3(body, deliveryId) {
273
274
const uploadHour = date . getHours ( ) . toString ( ) . padStart ( 2 , "0" ) ; // ex. get 05 instead of 5 for the 5th hour
274
275
const bucketPath = `${ uploadYear } -${ uploadMonth } -${ uploadDate } /${ uploadHour } /${ deliveryId } ` ;
275
276
277
+ const fullPayload = { }
278
+ fullPayload [ eventType ] = eventType ;
279
+ fullPayload [ body ] = body ;
280
+
276
281
const command = new PutObjectCommand ( {
277
282
Bucket : process . env . BUCKET_NAME ,
278
283
Key : bucketPath ,
279
- Body : JSON . stringify ( body ) ,
284
+ Body : JSON . stringify ( fullPayload ) ,
280
285
ContentType : "application/json" ,
281
286
} ) ;
282
287
try {
0 commit comments