242 lines · 9.6 KB
import { evaluateCondition } from "./expressions";
import type { ExprContext, ExprValue } from "./expressions";
import { compileUses } from "./builtin-actions";
import type { CacheSpec } from "./builtin-actions";
import { expandMatrix, matrixLabel } from "./matrix";
import { resolvePermissions } from "./permissions";
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";
  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;
};

export type CompiledJob = {
  key: string;
  baseKey: string;
  name: string;
  runsOn: string[];
  needs: string[];
  runIfOk: boolean;
  runIfFailed: boolean;