Embedded Action
The embedded action runs a job file as a single step, which lets shared setup or checks live in their own file and be reused from several workflows.
The file is a job, not a workflow: it holds name, steps and optionally defaults - there is no jobs key in it.
Basic Syntax
auth.yml:
name: Authentication
steps:
- name: Get token
id: get_token
uses: shell
with:
cmd: echo "0123456789"
test: res.code == 0
outputs:
mytoken: replace(res.stdout, '\n', '')workflow.yml:
jobs:
- name: Main
steps:
- name: Authenticate
id: auth
uses: embedded
with:
path: "./auth.yml"
vars:
environment: "{{vars.environment}}"
test: res.code == 0
outputs:
token: res.outputs.mytoken
- name: Call the API
uses: http
with:
method: GET
url: "{{vars.api_url}}/me"
headers:
authorization: "Bearer {{outputs.auth.token}}"
test: res.code == 200Parameters
An embedded step names the job file to run and the variables to hand it.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
path | String | Yes | - | Path to the job file. Resolved against the current working directory, not the workflow file |
vars | Object | No | {} | Variables passed to the embedded job, read there as vars.<name> |
Inside the job file, a local external action such as uses: ./greet is found relative to the job file itself, the way one in a workflow is found relative to the workflow file.
Response Object
After the embedded job finishes, res carries its result and its outputs.
| Field | Type | Description |
|---|---|---|
res.code | Integer | 0 when every step of the embedded job passed |
res.outputs | Object | The outputs published by the embedded job’s steps, keyed by output name |
res.report | String | The embedded job’s report, which is also nested into the parent report |
res.error | String | Error message, when the embedded job failed |
res.dump | Boolean | Always false |
status | Integer | Same as res.code |
rt | Object | Time spent running the embedded job |
res.outputs is keyed by output name, so a value published as mytoken is read as res.outputs.mytoken. The same value is also under the id of the step that published it, as res.outputs.get_token.mytoken. When two steps publish the same name, res.outputs.<name> holds the value of the step that published it first, and the step-keyed form holds each one.