Skip to content

Commit 94f1b05

Browse files
committed
feat(dispatch): enhance logging for workflow job events and dispatch status
1 parent 391a65f commit 94f1b05

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

lambdas/functions/webhook/src/runners/dispatch.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ async function handleWorkflowJob(
3636
body: `Workflow job not queued, not dispatching to queue.`,
3737
};
3838
}
39+
40+
logger.debug(
41+
`Processing workflow job event - Repository: ${body.repository.full_name}, ` +
42+
`Job ID: ${body.workflow_job.id}, Job Name: ${body.workflow_job.name}, ` +
43+
`Run ID: ${body.workflow_job.run_id}, Labels: ${JSON.stringify(body.workflow_job.labels)}`,
44+
);
3945
// sort the queuesConfig by order of matcher config exact match, with all true matches lined up ahead.
4046
matcherConfig.sort((a, b) => {
4147
return a.matcherConfig.exactMatch === b.matcherConfig.exactMatch ? 0 : a.matcherConfig.exactMatch ? -1 : 1;
@@ -51,7 +57,10 @@ async function handleWorkflowJob(
5157
queueId: queue.id,
5258
repoOwnerType: body.repository.owner.type,
5359
});
54-
logger.info(`Successfully dispatched job for ${body.repository.full_name} to the queue ${queue.id}`);
60+
logger.info(
61+
`Successfully dispatched job for ${body.repository.full_name} to the queue ${queue.id} - ` +
62+
`Job ID: ${body.workflow_job.id}, Job Name: ${body.workflow_job.name}, Run ID: ${body.workflow_job.run_id}`,
63+
);
5564
return {
5665
statusCode: 201,
5766
body: `Successfully queued job for ${body.repository.full_name} to the queue ${queue.id}`,
@@ -61,7 +70,9 @@ async function handleWorkflowJob(
6170
const notAcceptedErrorMsg = `Received event contains runner labels '${body.workflow_job.labels}' from '${
6271
body.repository.full_name
6372
}' that are not accepted.`;
64-
logger.warn(notAcceptedErrorMsg);
73+
logger.warn(
74+
`${notAcceptedErrorMsg} - Job ID: ${body.workflow_job.id}, Job Name: ${body.workflow_job.name}, Run ID: ${body.workflow_job.run_id}`,
75+
);
6576
return { statusCode: 202, body: notAcceptedErrorMsg };
6677
}
6778

0 commit comments

Comments
 (0)