Skip to content

Guides / Use GitHub actions in steps

Use GitHub actions in steps

A uses: step runs a GitHub action, the same as in a GitHub workflow. Checkout, language setup, caching and most Marketplace actions carry over unchanged.

  • The action’s owner/repo@ref, from its Marketplace page or README.
  1. .hatchrun/config.yml
    jobs:
    build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v5
    - uses: actions/setup-go@v5
    with:
    go-version: '1.25'
    - run: go build ./...

    hatchrun fetches the action from GitHub at the ref you name.

  2. with holds the action’s inputs. Values can hold expressions:

    .hatchrun/config.yml
    jobs:
    upload:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/upload-artifact@v4
    with:
    name: report-${{ github.sha }}
    path: reports/
    retention-days: 7
  3. Give the step an id. Later steps read its outputs as ${{ steps.ID.outputs.NAME }}:

    .hatchrun/config.yml
    jobs:
    tag:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v5
    - id: meta
    uses: docker/metadata-action@v5
    with:
    images: ghcr.io/my-org/app
    - run: echo "${{ steps.meta.outputs.tags }}"
  4. Pin third-party actions to a full commit SHA. A tag such as v5 can be moved to new code; a SHA cannot:

    .hatchrun/config.yml
    jobs:
    build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  5. Terminal window
    hatchrun validate
Action type Status
JavaScript actions At launch
Composite actions At launch
Local actions, uses: ./path At launch
Docker container actions A later release
uses: docker://image Not supported yet; an error

The machine provides the github context and the GITHUB_* variables and files that actions expect, such as GITHUB_OUTPUT and GITHUB_ENV.

uses, with, name, id, env, if and continue-on-error. shell, working-directory and timeout-minutes belong to run: steps only.