Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions upsertGitHubTag/deployment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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:
Expand Down