Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add verbose option #46

Merged
merged 4 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
```

Expand Down
19 changes: 12 additions & 7 deletions src/act/act.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand All @@ -295,17 +300,19 @@ 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
);
}

if (opts?.bind) {
actArguments.push("--bind");
}

if (opts?.verbose) {
actArguments.push("--verbose");
}

if (this.containerOpts.containerArchitecture) {
actArguments.push("--container-architecture", this.containerOpts.containerArchitecture);
}
Expand All @@ -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 };
Expand Down
1 change: 1 addition & 0 deletions src/act/act.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export type RunOpts = {
mockApi?: ResponseMocker<unknown, number>[];
mockSteps?: MockStep;
logFile?: string;
verbose?: boolean;
};

export type ContainerOpts = {
Expand Down