Skip to main content

Using an action

Reference an action from a step with uses, pass inputs with with, and give the step an id to read the action's outputs in later steps:

jobs:
hello:
steps:
- uses: global:greet@latest
id: greeting
with:
name: "Workflows"

- name: Print greeting
run: echo "${{ .steps.greeting.outputs.message }}"

The action's steps run inline in the hello job, so the "Print greeting" step shares their filesystem and can read the message output.

A step that uses uses must not also set run, upload, or download.

Reference formats

The uses value identifies an action revision. Two equivalent forms are accepted; both require a workspace, an action, and a revision:

<reference> ::= <resource-name> | <compact>
<resource-name> ::= workspaces/{ws}/actions/{action}/revisions/{rev}
<compact> ::= {ws}:{action}@{rev}
<rev> ::= <canonical-id> | "latest"
IntentFull resource nameCompact
Latest revisionworkspaces/global/actions/greet/revisions/latestglobal:greet@latest
Pinned revisionworkspaces/global/actions/greet/revisions/c7cfa2a8global:greet@c7cfa2a8
  • A workspace, action, and revision are all required. A value containing / is the full resource name, otherwise it is the compact form.
  • The revision is either a canonical revision id (returned when you publish; pin it for reproducible runs) or the reserved alias latest (the newest revision, resolved when the step runs). See Publishing and revisions.

Full example

A complete workflow that calls the greet action and uses its output in a later step:

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