import * as internal from "./internal.js"; import { type ExpressionSource, ExpressionValue } from "./expression.js"; import type { Permissions } from "./permissions.js"; import { type ConditionLike, type ConfigValue, Step, type StepLike } from "./step.js"; interface CommonJobFields { name?: string | ExpressionValue; needs?: Job[]; if?: ConditionLike; permissions?: Permissions; concurrency?: { group: string; cancelInProgress?: boolean | string; }; continueOnError?: boolean | string; } /** A Docker container used as a job `container` or as a job service. */ export interface ServiceContainer { image: string; credentials?: { username: string; password: string | ExpressionValue; }; env?: Record; ports?: string[]; volumes?: string[]; options?: string; } /** The runner(s) a job runs on. */ export type RunsOn = string | ExpressionValue | readonly string[] | { group?: string; labels?: string | readonly string[]; }; /** Default settings applied to every `run` step of a job or workflow. */ export interface JobDefaults { run?: { shell?: string; workingDirectory?: string; }; } /** Configuration shared by every job that runs its own steps. */ export interface StepsJobConfig extends CommonJobFields { runsOn: RunsOn; strategy?: { matrix?: unknown; failFast?: boolean | ConditionLike; maxParallel?: number; }; env?: Record; timeoutMinutes?: number; defaults?: JobDefaults; environment?: { name: string | ExpressionValue; url?: string; } | string | ExpressionValue; services?: Record; container?: ServiceContainer | string; } /** Configuration for a job that calls a reusable workflow. */ export interface ReusableJobConfig extends CommonJobFields { uses: string; with?: Record; secrets?: "inherit" | Record; } /** Configuration for a job, without its identity or steps. */ export type JobConfig = StepsJobConfig | ReusableJobConfig; /** A steps job as declared in a `workflow({ jobs })` array. */ export interface StepsJobDef extends StepsJobConfig { id?: string; steps: StepLike | StepLike[]; outputs?: Record; } /** A reusable workflow job as declared in a `workflow({ jobs })` array. */ export interface ReusableJobDef extends ReusableJobConfig { id?: string; } /** A job as declared in a `workflow({ jobs })` array. */ export type JobDef = StepsJobDef | ReusableJobDef; /** * A resolved job. Prefer the `job()` free function over constructing this * directly. */ export declare class Job implements ExpressionSource { #private; /** Expressions referencing this job's outputs from a dependent job. */ readonly outputs: Readonly>; constructor(id: string, config: JobConfig, init?: { steps?: StepLike[]; outputs?: Record; }); /** The job's id, used as its key in the workflow's `jobs` map. */ get id(): string; /** * Resolves every step the job runs, in execution order, with parallel group * members flattened into the list. `#resolveUnits` is the grouped form used * for serialization. */ [internal.resolveSteps](): Step[]; /** * Infers the jobs this job depends on: the explicitly declared `needs` plus * every job referenced by an expression anywhere in the job's configuration * or steps. The result is deduplicated and ordered deterministically. */ [internal.inferNeeds](stepOwners?: Map, Job[]>): Job[]; /** Serializes the job to its GitHub Actions YAML object representation. */ [internal.toYaml](stepOwners?: Map, Job[]>): Record; /** * Serializes the job's resolved steps and the outputs declared against them. * * Steps are resolved before outputs so outputs can be validated against the * steps that actually survive condition filtering. `owner` and `ownerNoun` * name what the steps belong to in that validation's error message, so a * composite action built on this method reports itself rather than a job. */ [internal.toStepsYaml](owner: string, ownerNoun: string): { steps: unknown[]; outputs: Record | undefined; }; } /** Creates a job with the given id. */ export declare function job(id: string, config: JobDef): Job; /** * Serializes a `defaults` block, or returns undefined when it carries no * settings at all. */ export declare function serializeDefaults(defaults: JobDefaults): Record | undefined; /** Converts a human readable name into a kebab-cased job id. */ export declare function toKebabCase(input: string): string; /** * Resolves a job definition's id, deriving it from a string `name` when no * explicit `id` was given. */ export declare function resolveJobId(def: JobDef): string; export {}; //# sourceMappingURL=job.d.ts.map