Skip to content

Commit

Permalink
Merge pull request #756 from chromaui/tom/ap-3253-update-cli-to-be-ca…
Browse files Browse the repository at this point in the history
…llable-from-node-and-return-buildid-2

Added `onTaskComplete` callback option
  • Loading branch information
tmeasday committed Jun 13, 2023
2 parents 0e2f1ec + 7223c7b commit aa17ab3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions node-src/lib/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export const createTask = ({ title, steps, ...config }): Listr.ListrTask<Context
// eslint-disable-next-line no-await-in-loop
await step(ctx, task);
}

ctx.options.onTaskComplete?.({ ...ctx });
},
...config,
});
Expand Down
3 changes: 3 additions & 0 deletions node-src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ export interface Options {
branchName: string;
patchHeadRef: string;
patchBaseRef: string;

/** A callback that is called at the completion of each task */
onTaskComplete?: (ctx: Context) => void;
}

export interface Context {
Expand Down

0 comments on commit aa17ab3

Please sign in to comment.