Skip to content

Guides / Migrate a repository from GitHub Actions

Migrate a repository from GitHub Actions

This guide moves a repository’s GitHub Actions workflows to hatchrun CI. hatchrun convert does most of the work. You read what it reports, fix the few things it cannot map, and validate the result.

  • The hatchrun CLI. See the Quickstart.
  • A local clone of the repository with workflows in .github/workflows/.
  1. From the root of the repository:

    Terminal window
    hatchrun convert -o .hatchrun/config.yml

    convert reads every .yml and .yaml file in .github/workflows/. Each file becomes a workflow named after the file, and each job becomes a job named FILE-JOB.

    The config goes to .hatchrun/config.yml, and the warnings and errors to your terminal.

    To convert some files only, name them:

    Terminal window
    hatchrun convert .github/workflows/ci.yml -o .hatchrun/config.yml
  2. Terminal window
    echo $?
    • 0: everything converted. There may be warnings.
    • 1: some jobs, events or files were left out. The config holds the rest. If nothing converted, no file was written.
  3. A warning means a key was dropped or changed, and the config works without it. Decide for each whether you need a replacement. The convert warnings table below says what to do.

  4. An error means a job, an event, an input or a file was left out of the config. Fix the cause in the GitHub workflow and convert again, or add what is missing to the config by hand. See Fix common problems.

  5. Terminal window
    hatchrun validate

    No output means the config is valid.

  6. Commit .hatchrun/config.yml. Once hatchrun CI runs a workflow, delete the GitHub file it came from. Until then GitHub runs it too, and both report checks.

This workflow lints, then tests on two Node versions and two operating systems:

.github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- run: npm ci
- run: npm run lint
test:
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
node: [20, 22]
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: npm ci
- run: npm test

hatchrun convert prints four warnings and exits with 0:

`ci.yml`: `concurrency` is not supported and was dropped
`ci.yml` job `lint`: `runs-on: ubuntu-24.04` became `ubuntu-latest`, which runs Ubuntu 26.04
`ci.yml` job `test`: `strategy.fail-fast` is not supported and was dropped
`ci.yml` job `test`: matrix key `os` values `macos-latest` name no runner template and were dropped; hatchrun runs Linux only

It writes this config:

.hatchrun/config.yml
jobs:
ci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: npm ci
- run: npm run lint
ci-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: npm ci
- run: npm test
workflows:
ci:
"on":
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
- ci-lint:
name: lint
- ci-test:
name: test
requires:
- lint
matrix:
node:
- 20
- 22
os:
- ubuntu-latest

What changed, warning by warning:

  • concurrency has no equivalent. Pushes no longer cancel older runs of the same branch.
  • ubuntu-24.04 is not a runner template. The job now runs on ubuntu-latest, which is Ubuntu 26.04. Check that your toolchain works there.
  • fail-fast has no equivalent. hatchrun has no setting for it.
  • hatchrun runs Linux only, so the macOS legs are gone. The run plans test (20, ubuntu-latest) and test (22, ubuntu-latest).

Each workflow entry keeps the GitHub job id as its name, so requires: [lint] and the check run names stay the same.

Every message starts with the file, and the job and step when there is one. The error and warning messages reference lists them all.

Warning says What you lose What to do
`concurrency` is not supported and was dropped Cancelling older runs Nothing, or keep the workflow on GitHub if you depend on it
`permissions` is not supported and was dropped A narrower job token Nothing
`environment.url` is not supported and was dropped The deployment URL GitHub shows Nothing
`services` is not supported and was dropped Service containers Start them in a run: step. See services
`strategy.matrix.include` is not supported Extra or changed matrix legs See matrix include
became `ubuntu-latest`, which runs Ubuntu 26.04 Ubuntu 24.04 or 22.04 Test on 26.04
name no runner template and were dropped; hatchrun runs Linux only macOS and Windows legs Keep those on GitHub Actions
calls a reusable workflow, which is not supported The whole job See reusable workflows
`on.release` is not supported and was dropped That event Keep the workflow on GitHub, or use a tag push

A runs-on such as ${{ matrix.os }} converts when every value maps to one runner template. Values that name no template are dropped with a warning. Values that map to two templates are an error:

.github/workflows/build.yml
on: push
jobs:
a:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-26.04-arm]
steps:
- run: make
`build.yml` job `a` has `runs-on: ${{ matrix.os }}` over legs that run on `ubuntu-latest`, `ubuntu-26.04-arm`; a job runs on one runner template

A job runs on one template in hatchrun. Split it into one job per template in the config and list both in the workflow. Any other expression in runs-on, such as ${{ inputs.runner }}, is an error. Set a label by hand.

convert keeps a job’s environment, as a name or as a map with name. The environment itself does not convert, because it lives in GitHub’s settings. Recreate each one in the hatchrun app:

In GitHub In hatchrun
Deployment branches and tags The environment’s branch patterns. Tag rules have no match, and neither do pull request runs
Required reviewers Require approval. Any organization admin can approve, whatever reviewers GitHub named
Wait timer Not supported
Environment secrets and variables The environment’s secrets and variables
Repository secrets and variables The repository’s secrets and variables
Organization secrets, “Repository access” The organization secret’s repository access: all repositories or selected ones

A job that names an environment fails until you create it, and the check run says so. A name that is an expression, such as ${{ matrix.target }}, is an error and the job is left out. Write the name out, or split the job. See Environments and Secrets and variables.

GitHub shows an environment’s URL on the run. hatchrun drops it.

hatchrun drops services: with a warning. Each job has a whole machine with Docker, so start the service yourself:

.hatchrun/config.yml
jobs:
test:
runs-on: ubuntu-latest
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/test
steps:
- uses: actions/checkout@v5
- run: |
docker run -d --name db -p 5432:5432 \
-e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=test postgres:17
until docker exec db pg_isready -U postgres; do sleep 1; done
- run: make test

include and exclude are dropped with a warning, and only plain lists of values convert. Rebuild what they did with more workflow entries. To add one extra leg, list the job a second time with a name and the values as parameters:

.hatchrun/config.yml
jobs:
test:
runs-on: ubuntu-latest
parameters:
node: { type: integer }
steps:
- uses: actions/setup-node@v4
with:
node-version: ${{ parameters.node }}
- run: npm test
workflows:
ci:
on:
push: {}
jobs:
- test:
matrix:
node: [20, 22]
- test:
name: test-next
node: 24

To exclude a leg, split the matrix into two entries that each list only the combinations you want.

A job with uses: at job level calls a reusable workflow. convert drops it, and every job that needs it, with warnings:

.github/workflows/ci.yml
on: push
jobs:
call:
uses: my-org/shared/.github/workflows/build.yml@main
after:
needs: call
runs-on: ubuntu-latest
steps:
- run: make release
`ci.yml` job `call` calls a reusable workflow, which is not supported; the job was dropped
`ci.yml` job `after` was dropped: it needs `call`, which calls a reusable workflow

Copy the reusable workflow’s jobs into the config, and turn steps they share into a command.

uses: docker://... is an error, and the job is dropped. Replace the step with a run: step that calls docker run:

.hatchrun/config.yml
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: docker run --rm -v "$PWD:/src" aquasec/trivy:latest fs /src

${{ strategy.job-index }}, ${{ jobs.x }} and other reads of the strategy and jobs contexts are errors.

Use ${{ matrix.KEY }} for matrix values, and job outputs with needs for results of other jobs.