runBeforeRun method

Future<WorkspaceHookOutcome> runBeforeRun(
  1. Workspace workspace
)

Runs the configured before_run hook.

Throws when the hook is fatal so the scheduler can fail the attempt.

Implementation

Future<WorkspaceHookOutcome> runBeforeRun(Workspace workspace) async {
  final outcome = await hookRunner.run(
    kind: WorkspaceHookKind.beforeRun,
    workspacePath: workspace.path,
    hooks: hooksConfig,
  );
  if (outcome.isFatal) {
    throw WorkspaceException(
      outcome.timedOut
          ? WorkspaceFailureCode.hookTimedOut
          : WorkspaceFailureCode.hookFailed,
      'before_run hook failed: ${outcome.output}',
    );
  }
  return outcome;
}