(triggerId: string, body: Record<string, unknown>)
| 43 | * Returns whether an Azure DevOps service hook payload matches the configured trigger. |
| 44 | */ |
| 45 | export function isAzureDevOpsEventMatch(triggerId: string, body: Record<string, unknown>): boolean { |
| 46 | if (triggerId === 'azure_devops_webhook') { |
| 47 | return true |
| 48 | } |
| 49 | |
| 50 | const eventType = body.eventType as string | undefined |
| 51 | |
| 52 | if (triggerId === 'azure_devops_build_failed') { |
| 53 | if (eventType !== AZURE_DEVOPS_BUILD_FAILED_EVENT) { |
| 54 | return false |
| 55 | } |
| 56 | const resource = body.resource as Record<string, unknown> | undefined |
| 57 | const result = (resource?.result as string | undefined)?.toLowerCase() |
| 58 | return ( |
| 59 | result === 'failed' || |
| 60 | result === 'canceled' || |
| 61 | result === 'cancelled' || |
| 62 | result === 'stopped' || |
| 63 | result === 'partiallysucceeded' |
| 64 | ) |
| 65 | } |
| 66 | |
| 67 | if (triggerId === 'azure_devops_work_item_created') { |
| 68 | return eventType === AZURE_DEVOPS_WORK_ITEM_CREATED_EVENT |
| 69 | } |
| 70 | |
| 71 | return false |
| 72 | } |
| 73 | |
| 74 | export function buildBuildFailedOutputs(): Record<string, TriggerOutput> { |
| 75 | return { |
no outgoing calls
no test coverage detected