Skip to content

Commit 5c8a177

Browse files
Adam GoughAdam Gough
authored andcommitted
test
1 parent 615bafe commit 5c8a177

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

apps/sim/executor/index.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1606,13 +1606,32 @@ export class Executor {
16061606
}
16071607

16081608
// Handle error outputs and ensure object structure
1609-
const output: NormalizedBlockOutput =
1609+
let output: NormalizedBlockOutput =
16101610
rawOutput && typeof rawOutput === 'object' && rawOutput.error
16111611
? { error: rawOutput.error, status: rawOutput.status || 500 }
16121612
: typeof rawOutput === 'object' && rawOutput !== null
16131613
? rawOutput
16141614
: { result: rawOutput }
16151615

1616+
// Normalize trigger outputs: for GitHub triggers, promote nested github payload to root
1617+
try {
1618+
const isTriggerBlock = block.metadata?.category === 'triggers' || block.config?.params?.triggerMode === true
1619+
const provider = (output as any)?.webhook?.data?.provider
1620+
if (isTriggerBlock && provider === 'github') {
1621+
const candidate = (output as any).github || (output as any)?.webhook?.data?.payload || output
1622+
const normalized: Record<string, any> = {
1623+
...(typeof candidate === 'object' && candidate !== null ? candidate : {}),
1624+
webhook: (output as any)?.webhook,
1625+
}
1626+
if (normalized.github) {
1627+
delete normalized.github
1628+
}
1629+
output = normalized as NormalizedBlockOutput
1630+
}
1631+
} catch {
1632+
// Non-fatal: keep original output
1633+
}
1634+
16161635
// Update the context with the execution result
16171636
// Use virtual block ID for parallel executions
16181637
context.blockStates.set(blockId, {

0 commit comments

Comments
 (0)