Skip to main content

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 asa separate child run with its own sandboxinline, within the calling job
Filesystemisolated (data passes through H2O Drive)shared with the other steps in the job
Returns valuesnoyes, via outputs

What you will find

Defining an action

The action document: typed inputs, declared outputs, and steps.

Using an action

Call an action from a step with uses and with, and read its outputs.

Publishing and revisions

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"

Feedback