import { WebhookPayloadDeploymentStatus } from "@octokit/webhooks" ; import { Context , MessageHandler } from "./index" ; import app from "../worker/app" ; import { processDeployment } from "../github/deployment" ; export type DeploymentMessagePayload = { jiraHost : string ; installationId : number ; webhookReceived : number ; webhookId : string ; webhookPayload : WebhookPayloadDeploymentStatus ; } ; export const deploymentQueueMessageHandler = async ( context ) => { context . log . info ( "Handling deployment message from the SQS queue" ) ; const messagePayload = context . payload ; const github = await app . auth ( messagePayload . installationId ) ; await processDeployment ( github , messagePayload . webhookId , messagePayload . webhookPayload , new Date ( messagePayload . webhookReceived ) , messagePayload . jiraHost , messagePayload . installationId , context . log ) ; } ;