diff --git a/README.md b/README.md index 744fe8a..60c6fb2 100644 --- a/README.md +++ b/README.md @@ -215,17 +215,17 @@ When running a job (which ever way), you can optionally pass run options ```typescript { - cwd?: string; // overrides the global cwd and uses the one passed in options - workflowFile?: string; // overrides the global workflow file path and uses the one passed in options - bind?: boolean; // bind the cwd instead of copying it during workflow execution - // activates the artifact server - artifactServer?: { - path: string; // where to store the uploaded artifacts - port: string; // where to run the artifact server + cwd?: string; // overrides the global cwd and uses the one passed in options + workflowFile?: string; // overrides the global workflow file path and uses the one passed in options + bind?: boolean; // bind the cwd instead of copying it during workflow execution + artifactServer?: { // activates the artifact server + path: string; // where to store the uploaded artifacts + port: string; // where to run the artifact server }; - mockApi: ResponseMocker[]; // specify the apis you want to mock. ResponseMocker is from mock-github - mockSteps: MockStep; // specify which steps you want to mock - logFile?: string; // write the raw output act produces to this file for debugging purposes + mockApi: ResponseMocker[]; // specify the apis you want to mock. ResponseMocker is from mock-github + mockSteps: MockStep; // specify which steps you want to mock + logFile?: string; // write the raw output act produces to this file for debugging purposes + verbose?: true; // enable versbose logging } ``` diff --git a/src/act/act.ts b/src/act/act.ts index df8b0be..b45557f 100644 --- a/src/act/act.ts +++ b/src/act/act.ts @@ -282,11 +282,16 @@ export class Act { } private async parseRunOpts(opts?: RunOpts) { - let proxy: ForwardProxy | undefined = undefined; const actArguments: string[] = []; + const cwd = opts?.cwd ?? this.cwd; + const workflowFile = opts?.workflowFile ?? this.workflowFile; + let proxy: ForwardProxy | undefined = undefined; + if (opts?.mockApi) { proxy = new ForwardProxy(opts.mockApi); + const address = await proxy.start(); + this.setEnv("http_proxy", `http://${address}`); this.setEnv("https_proxy", `http://${address}`); this.setEnv("HTTP_PROXY", `http://${address}`); @@ -295,10 +300,8 @@ export class Act { if (opts?.artifactServer) { actArguments.push( - "--artifact-server-path", - opts?.artifactServer.path, - "--artifact-server-port", - opts?.artifactServer.port + "--artifact-server-path", opts?.artifactServer.path, + "--artifact-server-port", opts?.artifactServer.port ); } @@ -306,6 +309,10 @@ export class Act { actArguments.push("--bind"); } + if (opts?.verbose) { + actArguments.push("--verbose"); + } + if (this.containerOpts.containerArchitecture) { actArguments.push("--container-architecture", this.containerOpts.containerArchitecture); } @@ -318,8 +325,6 @@ export class Act { actArguments.push("--container-options", this.containerOpts.containerOptions); } - const cwd = opts?.cwd ?? this.cwd; - const workflowFile = opts?.workflowFile ?? this.workflowFile; actArguments.push("-W", workflowFile); return { cwd, proxy, actArguments }; diff --git a/src/act/act.type.ts b/src/act/act.type.ts index dbb2e46..14f0180 100644 --- a/src/act/act.type.ts +++ b/src/act/act.type.ts @@ -32,6 +32,7 @@ export type RunOpts = { mockApi?: ResponseMocker[]; mockSteps?: MockStep; logFile?: string; + verbose?: boolean; }; export type ContainerOpts = {