diff --git a/upsertGitHubTag/deployment/index.js b/upsertGitHubTag/deployment/index.js index b722d00..c619dac 100644 --- a/upsertGitHubTag/deployment/index.js +++ b/upsertGitHubTag/deployment/index.js @@ -120,6 +120,15 @@ function deleteEndpoint( req.end(); } +function handleReleaseEvent(githubEventType, body, deliveryId, path, callback) { + console.log("Valid release event ", deliveryId); + const fullPath = path + "workflows/github/taggedrelease"; + logPayloadToS3(githubEventType, body, deliveryId); + postEndpoint(fullPath, body, deliveryId, (response) => { + handleCallback(response, "", callback); + }); +} + // Performs an action based on the event type (action) function processEvent(event, callback) { // Usually returns array of records, however it is fixed to only return 1 record @@ -169,7 +178,7 @@ function processEvent(event, callback) { // Handle installation events if (githubEventType === "installation_repositories") { // The installation_repositories event contains information about both additions and removals. - console.log("Valid installation event"); + console.log("Valid installation event ", deliveryId); logPayloadToS3(githubEventType, body, deliveryId); //upload event to S3 @@ -206,7 +215,7 @@ function processEvent(event, callback) { // A push has been made for some repository (ignore pushes that are deletes) if (!body.deleted) { - console.log("Valid push event"); + console.log("Valid push event ", deliveryId); logPayloadToS3(githubEventType, body, deliveryId); //upload event to S3 const repository = body.repository.full_name; @@ -224,7 +233,7 @@ function processEvent(event, callback) { handleCallback(response, successMessage, callback); }); } else { - console.log("Valid push event (delete)"); + console.log("Valid push event (delete) ", deliveryId); logPayloadToS3(githubEventType, body, deliveryId); //upload event to S3 const repository = body.repository.full_name; const gitReference = body.ref; @@ -251,8 +260,10 @@ function processEvent(event, callback) { } ); } + } else if (githubEventType === "release") { + handleReleaseEvent(githubEventType, body, deliveryId, path, callback); } else { - console.log("Event " + githubEventType + " is not supported"); + console.log("Event " + githubEventType + " is not supported", deliveryId); callback(null, { statusCode: 200, body: