MCPcopy
hub / github.com/actionsflow/actionsflow / run

Function run

packages/actionsflow/src/trigger.ts:29–342  ·  view source on GitHub ↗
({
  trigger,
  event,
  workflow,
  cwd,
  dest,
}: ITriggerInternalOptions)

Source from the content-addressed store, hash-verified

27const allTriggers = Triggers as Record<string, ITriggerClassTypeConstructable>;
28
29export const run = async ({
30 trigger,
31 event,
32 workflow,
33 cwd,
34 dest,
35}: ITriggerInternalOptions): Promise<ITriggerInternalResult> => {
36 log.debug("Trigger event: ", event);
37 const originLogLevel = log.getLevel();
38 const finalResult: ITriggerInternalResult = {
39 items: [],
40 outcome: "success",
41 conclusion: "success",
42 };
43
44 const Trigger = trigger.class;
45
46 if (Trigger) {
47 const triggerCacheManager = getTriggerManageCache({
48 name: trigger.name,
49 workflowRelativePath: workflow.relativePath,
50 });
51 const triggerConstructorParams = await getTriggerConstructorParams({
52 name: trigger.name,
53 workflow: workflow,
54 options: trigger.options,
55 });
56 finalResult.helpers = triggerConstructorParams.helpers;
57 const triggerInstance = new Trigger(triggerConstructorParams);
58
59 let triggerResult: ITriggerResult | undefined;
60
61 if (triggerInstance) {
62 const triggerGeneralOptions = getGeneralTriggerFinalOptions(
63 triggerInstance,
64 trigger.options,
65 event,
66 {
67 cwd,
68 dest,
69 }
70 );
71 const {
72 shouldDeduplicate,
73 limit,
74 filter,
75 filterOutputs,
76 format,
77 sort,
78 skip,
79 skipFirst,
80 force,
81 logLevel,
82 filterScript,
83 sortScript,
84 } = triggerGeneralOptions;
85 if (logLevel) {
86 log.setLevel(logLevel);

Callers 2

trigger.test.tsFile · 0.90
runSettledFunction · 0.70

Calls 8

getTriggerManageCacheFunction · 0.90
getWebhookByRequestFunction · 0.90
isPromiseFunction · 0.90
getStringFunctionResultFunction · 0.90
getMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected