Actions
A composite action is a reusable, versioned group of steps with typed inputs and outputs. Unlike a reusable workflow, a composite action runs inline within the calling job: its steps share the job's filesystem and environment, and it can return outputs that later steps reference.
Actions are a resource in their own right: you author an action as a standalone YAML document,
publish it to create immutable revisions, and reference a revision from any workflow in the
workspace with uses.
Composite action vs. reusable workflow
Reusable workflow (workflow: on a job) | Composite action (uses: on a step) | |
|---|---|---|
| Runs as | a separate child run with its own sandbox | inline, within the calling job |
| Filesystem | isolated (data passes through H2O Drive) | shared with the other steps in the job |
| Returns values | no | yes, via outputs |
What you will find
The action document: typed inputs, declared outputs, and steps.
Call an action from a step with uses and with, and read its outputs.
The draft-and-revision lifecycle: publish, pin, or track latest.
Quick example
An action that composes a greeting:
id: greet
name: Greet
inputs:
name:
type: string
default: "world"
outputs:
message:
description: "The composed greeting"
value: ${{ .steps.compose.outputs.message }}
steps:
- id: compose
env:
NAME: ${{ .inputs.name }}
run: echo "message=Hello, ${NAME}!" >> "$H2O_WORKFLOWS_OUTPUT"
A workflow that calls it and uses its output:
id: hello-workflow
name: Hello
jobs:
hello:
steps:
- uses: global:greet@latest
id: greeting
with:
name: "Workflows"
- name: Print greeting
env:
MESSAGE: ${{ .steps.greeting.outputs.message }}
run: echo "$MESSAGE"
- Submit and view feedback for this page
- Send feedback about H2O Workflows to cloud-feedback@h2o.ai