A RelaGit workflow normally runs in a sandboxed environment in electron’s renderer process. This means that you can’t use node modules like fs or path in your workflow.
native globalAny methods or variables you export from your native module will be available in your main workflow script via the native global value.
RelaGit automatically loads your native module when it runs your workflow, so you don’t need to worry about importing it. Simply use native.methodName to call your method.
index.tsimport {const Workflow: new (options: WorkflowOptions) => voidConstruct a new workflow runnerWorkflow } from "relagit:actions"; export default newnew Workflow(options: WorkflowOptions): voidWorkflow({WorkflowOptions.name: stringname: "My Workflow",WorkflowOptions.description?: string | undefineddescription: "A workflow that does something.",WorkflowOptions.hooks?: { navigate?: ((event: "navigate", params_0: Repository | undefined, params_1: GitFile | undefined) => void | Promise<void>) | undefined; ... 9 more ...; stash_pop?: ((event: "stash_pop", params_0: Repository) => void | Promise<...>) | undefined; } | undefinedhooks: {commit?: ((event: "commit", params_0: Repository, params_1: { message: string; description: string; }) => void | Promise<void>) | undefinedcommit() {const native: { someMethod: () => Promise<void>; }native.someMethod: () => Promise<void>someMethod(); }, }, });
As we recommend using TypeScript for your workflows, you can also define the types for your native methods alongside the official types in the relagit package.
native.d.tsimport * asimport _native_native from "src/native.ts"; declare global { constconst native: anynative: typeofimport _native_native; }
Tip
There is another global value defined by RelaGit, options, but you will hear more about that in the options section.