The typed model of a GitHub Actions workflow (commons 0030-generated-workflowsFR-002, FR-005): the triggers, the jobs, the steps, the strategy, the permissions and the concurrency of a workflow as values the compiler checks, so that a step that is neither uses nor run, a job with no step, a permission that is neither read nor write or an expression written as a plain string is a type error, and a mistake the types cannot say (an action with no version, a job that needs a job that is not there) is a finding of validateWorkflow. The files GitHub reads are made from these values by render.ts; nothing here reads or writes a file.
An expression is made with expr("matrix.os"), which gives ${{ matrix.os }} and a type of its own, so that a string that is meant to be read by the runner is told from one that is not. A step is a uses step or a run step (use(...) and run(...)), a job has its steps as a non-empty tuple, and a workflow has its jobs by id, in the order they are written. The condition of a job or a step (if) is the text of an expression without its ${{ }}, as GitHub reads it.
typeJob= {
readonlyname?:string;
readonlyrunsOn:Runner;
readonlytimeoutMinutes:number;
readonlyneeds?:readonlystring[];
/** The text of the condition, without `${{ }}`. */readonlywhen?:string;
readonlypermissions?:Permissions;
readonlyenvironment?: { readonlyname:string; readonlyurl?:string };
readonlyenv?:Readonly<Record<string, Scalar>>;
/** What the job gives the jobs that need it, by name: an expression of its steps' outputs. */readonlyoutputs?:Readonly<Record<string, Expr>>;
readonlystrategy?:Strategy;
readonlysteps:readonly [Step, ...Step[]];
/** A comment written above the job. */readonlycomment?:string;
};
type Triggers = {
readonly push?: Filter;
readonly pullRequest?: Filter;
/** Run by hand from the Actions page, wi…(626 characters)
typeTriggers= {
readonlypush?:Filter;
readonlypullRequest?:Filter;
/** Run by hand from the Actions page, with the inputs it asks for (true asks for none). */readonlyworkflowDispatch?:true| { readonlyinputs:Readonly<Record<string, DispatchInput>> };
/** Run on a schedule: each entry is a cron expression of five fields, in UTC. */readonlyschedule?:readonlystring[];
/** Called by another workflow. */readonlyworkflowCall?:true;
/** Run when other workflows of the repository have completed (on the default branch). */readonlyworkflowRun?: { readonlyworkflows:readonlystring[] };
};
What starts a generated workflow: pushes, pull requests, dispatch and schedule.
What is wrong with a workflow, one sentence each: no trigger, a job that needs a job that is not there or itself, a step that is wrong, and a name that is not a file's.
type Workflow = {
/** The file's name without its directory and extension: `data` is `.github/workflows/data.auto.yml`…(627 characters)
typeWorkflow= {
/** The file's name without its directory and extension: `data` is `.github/workflows/data.auto.yml`. */readonlyfile:string;
/** The workflow's name, which a check's name begins with. */readonlyname:string;
/** A comment written under the name. */readonlycomment?:string;
readonlyon:Triggers;
readonlypermissions?:Permissions;
readonlyenv?:Readonly<Record<string, Scalar>>;
readonlyconcurrency?: { readonlygroup:string; readonlycancelInProgress:boolean|Expr };
/** The jobs by id, in the order they are written. */readonlyjobs:Readonly<Record<string, Job>>;
};
A generated workflow: its name, triggers, permissions and jobs.
The cells of a matrix: the values of each axis, or an expression that gives the whole matrix (expr("fromJSON(needs.plan.outputs.linux)")), which a job reads from the output of another.