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:
- Accepts the uniform
RunOptions
object (read more about options). - Returns
RunResultInterface
for sync targets (syncFn
).Promise<RunResultInterface>
for async targets (all other targets).
- Run result is slightly different for different targets (read more about run result).
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 |