300 lines · 12.5 KB
import { evaluateCondition } from "./expressions";
import type { ExprContext, ExprValue } from "./expressions";
import { compileUses, isBuiltinAction } from "./builtin-actions";
import type { CacheSpec } from "./builtin-actions";
import { compileAction } from "./actions/compile-action";
import type { CompiledAction } from "./actions/compile-action";
import type { ResolvedActions } from "./actions/resolve";
import { expandMatrix, matrixLabel } from "./matrix";
import { resolvePermissions } from "./permissions";
import { withDockerRunner } from "./runner-sizes";
import type { TokenPermissions } from "./permissions";
import { interpolate, plainText, scriptText, shellName, stepVariable } from "./segments";
import type { Segment } from "./segments";
import type { JobSpec, StepSpec, WorkflowSpec } from "./spec";

export type { Segment } from "./segments";

export type CompiledStep = {
  index: number;
  id: string | null;
  name: string;
  kind: "run" | "upload-artifact" | "cache" | "noop" | "action";
  script: string;
  shell: string;
  workingDirectory: string | null;
  env: Array<[string, Segment[]]>;
  continueOnError: boolean;
  timeoutMinutes: number | null;
  runIfOk: boolean;
  runIfFailed: boolean;
  /** Bash test evaluated at runtime for conditions on earlier steps' outputs or outcomes. */
  runtimeCondition: string | null;
  artifact: { name: string; path: string } | null;
  cache: CacheSpec | null;
  /** A third-party (or local) JavaScript action; absent on specs stored before actions were supported. */
  action?: CompiledAction | null;
};

export type CompiledJob = {
  key: string;