Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 2.71 KB

run-targets.md

File metadata and controls

40 lines (31 loc) · 2.71 KB

Run targets

In the terms of the library, a run target - is a class that can run particular kind of GitHub actions. Run target also can contain an action config (the contents of action.yml file) and custom options.

The library supports 4 run targets, that can be created by calling factory methods in RunTarget.

TypeScript:

import {RunTarget} from 'github-action-ts-run-api';

JavaScript:

const RunTarget = require('github-action-ts-run-api').RunTarget;

Every target has a run(...) method that:

  1. Accepts the uniform RunOptions object (read more about options).
  2. Returns
    • RunResultInterface for sync targets (syncFn).
    • Promise<RunResultInterface> for async targets (all other targets).
  3. Run result is slightly different for different targets (read more about run result).

Overview

RunTarget static methods run() returns Description
syncFn FnRunResult Isolate and run a single function
asyncFn Promise<FnRunResult> Isolate, run and await promise from a single function
jsFile Promise<JsFileRunResult> Use JS file path to run in a child node process
mainJs, postJs, preJs Promise<JsFileRunResult> Use JS file specified in action.yml to run in a child node process
dockerAction Promise<DockerRunResult> Build and run Docker container action
dockerFile Promise<DockerRunResult> Build and run specified Dockerfile directly

Detailed description

👉 Single function target (syncFn, asyncFn)

👉 JavaScript file target (jsFile, mainJs, postJs, preJs)

👉 Docker target (dockerAction, dockerFile)