Loading converter...

How to Convert GitLab CI to GitHub Actions - Step by Step Guide

Step 1

Bring Your .gitlab-ci.yml

Open your GitLab repository and copy the .gitlab-ci.yml from its root, or upload the file directly.

•
Templates come along: hidden jobs such as .test_template, extends:, YAML anchors and !reference tags are merged into the jobs that use them.
•
Includes: files pulled in with include: are not part of what you paste. Paste their jobs in as well, or convert them separately.
•
Try the sample: click "Sample" to see a three-stage Node pipeline with a manual deploy.

Example: a small .gitlab-ci.yml

stages:
  - build
  - test

image: node:20

build:
  stage: build
  script:
    - npm ci
    - npm run build
  artifacts:
    paths:
      - dist/

test:
  stage: test
  script:
    - npm ci
    - npm test
Step 2

What Gets Converted

The output follows the GitHub Actions workflow syntax. Here is how the main GitLab pieces map across:

•
Stages: each job needs the jobs of the previous stage; your own needs: lists are kept as they are.
•
Conditions: rules, only and except become an if: on the job, and merge request rules add a pull_request trigger.
•
Scripts: before_script and script run in one step (they share a shell in GitLab too); after_script runs afterwards with if: always().
•
Containers: image becomes the job container, services become service containers under the same host names.
•
Files: cache becomes actions/cache, and artifacts are uploaded and then downloaded by the later jobs that would get them in GitLab.
•
The rest: allow_failure, timeout, environment, resource_group and parallel (including matrix) all have a GitHub counterpart.

Example: the Step 1 file as a workflow

name: CI
'on':
  push: {}
jobs:
  build:
    runs-on: ubuntu-latest
    container:
      image: node:20
    steps:
      - uses: actions/checkout@v4
      - name: build
        run: |-
          npm ci
          npm run build
      - name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: build-artifacts
          path: dist/
  test:
    runs-on: ubuntu-latest
    needs:
      - build
    container:
      image: node:20
    steps:
      - uses: actions/checkout@v4
      - name: Download artifacts of build
        uses: actions/download-artifact@v4
        with:
          name: build-artifacts
          path: dist
      - name: test
        run: |-
          npm ci
          npm test
Step 3

Review the Notes

Whatever needs a decision from you is written as comments at the top of the workflow. The ones that come up most:

•
Project variables: anything you set in GitLab's CI/CD settings is not in the file. Add it under Settings, Secrets and variables, Actions.
•
GitLab variables in scripts: $CI_COMMIT_SHA, $CI_COMMIT_BRANCH and friends are listed with the GitHub names to use instead.
•
Manual jobs: they run only when you start the workflow by hand; for deploy approvals, use environment reviewers.
•
Runners: runner tags are dropped and every job uses ubuntu-latest until you change runs-on.
Step 4

Add the Workflow to Your Repository

•
Download: click "Download" to save github-workflow.yml.
•
Save it: put the file in .github/workflows/ at the root of your repository (create the folder if needed).
•
Push and watch: GitHub picks the workflow up on the next push and shows the run on the Actions tab. act can run it locally first if you prefer.

Frequently Asked Questions

How do GitLab stages turn into GitHub jobs?

Each GitLab job becomes a GitHub job with the same name, cleaned up where GitHub needs a plain id (test:unit becomes test_unit and keeps its original name for display). GitHub has no stages, so every job needs the jobs of the stage before it, which gives the same order. A job with its own needs: list keeps that list instead, and needs: [] starts right away. Templates whose names start with a dot, extends: and YAML anchors are merged into each job first.

What happens to rules, only and except?

They become an if: on the job. $CI_PIPELINE_SOURCE == "merge_request_event" turns into a pull_request check and adds a pull_request trigger, $CI_COMMIT_BRANCH and $CI_COMMIT_TAG comparisons become checks on github.ref, and simple regexes such as /^release-/ become startsWith(). Your own variables are read from GitHub repository variables (vars.NAME). When a rule can't be rewritten, the job is set to run only when you start the workflow by hand, so a deploy never fires by accident, and the notes say which rule it was.

How is when: manual handled?

GitHub has no manual jobs inside an automatic run. A manual job is converted to run only when someone starts the workflow from the Actions tab (workflow_dispatch), still limited to the branches its rules or only: allowed. If what you really want is an approval before a deployment, add required reviewers to the job's GitHub environment instead.

Will values like long IDs, zip codes or dates change?

No. Variables keep the exact text you typed, so 8901240544102066246, 00501, 14.50, yes and 2024-01-15 come out unchanged, quoted where a YAML reader would otherwise turn them into a number, boolean or date. Script lines are copied character for character.

Why do my scripts still mention $CI_COMMIT_SHA?

Script text is never rewritten, and GitHub does not set GitLab's predefined variables. The notes at the top of the workflow list each one with its GitHub counterpart, such as $GITHUB_SHA for $CI_COMMIT_SHA and $GITHUB_REF_NAME for $CI_COMMIT_BRANCH. Inside variables: values, the ones with an exact match are switched to ${{ github.* }} expressions for you.

What is not converted?

include: files (they are not in what you paste), trigger jobs for child pipelines, runner tags, retry, coverage, artifact reports, changes: conditions and GitLab project variables stored in settings. Each one is listed in the comment block with the job it came from, so nothing disappears quietly.

Is my pipeline uploaded anywhere?

No. The conversion runs in your browser, nothing is sent to a server or kept, and a reload starts you off with an empty editor.

Coming from another CI service? There are converters for Bitbucket Pipelines, CircleCI, Travis CI and Azure Pipelines, and one for the opposite trip, GitHub Actions to GitLab CI.