mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-27 06:45:26 +02:00
15 lines
354 B
TypeScript
15 lines
354 B
TypeScript
import type { BinaryCheck } from '../types';
|
|
|
|
export const hasNodes: BinaryCheck = {
|
|
name: 'has_nodes',
|
|
description: 'Workflow contains at least one node',
|
|
kind: 'deterministic',
|
|
run(workflow) {
|
|
const count = (workflow.nodes ?? []).length;
|
|
return {
|
|
pass: count > 0,
|
|
...(count === 0 ? { comment: 'Workflow has no nodes' } : {}),
|
|
};
|
|
},
|
|
};
|