Loading converter...

How to Move a GitHub Actions Workflow to GitLab CI

Step 1

Input Your GitHub Actions Workflow

Start with a GitHub Actions workflow you already run. It can be a small test job or a release pipeline with a matrix and services:

•
Paste directly: Copy the YAML from .github/workflows/*.yml into the input editor.
•
Upload a file: Click "Upload" and pick the .yml or .yaml file.
•
Try the sample: Click "Sample" to load a two-job build and deploy workflow.

Example: GitHub Actions Workflow

name: CI Pipeline
on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - name: Run tests
        run: npm test
Step 2

What the Converter Changes

The output updates as you type. This is how the parts of a workflow line up with GitLab CI YAML:

•
Triggers: push and pull_request branch filters become workflow: rules: on $CI_COMMIT_BRANCH and $CI_MERGE_REQUEST_TARGET_BRANCH_NAME; wildcards turn into regular expressions.
•
Jobs: Each job gets a stage in dependency order and keeps its needs, so jobs that ran side by side on GitHub still do.
•
Runners and tools: setup-node, setup-python and similar actions choose the job image; GitLab clones the repository by itself, so checkout steps disappear.
•
Matrix builds: strategy.matrix becomes parallel: matrix, and ${{ matrix.node }} becomes $NODE.
•
Services, cache, artifacts: Service containers keep their image and env under an alias, actions/cache becomes cache:, and upload-artifact becomes artifacts:.

Example: the Same Workflow as .gitlab-ci.yml

# Converted from the GitHub Actions workflow "CI Pipeline".

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main"
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"
stages:
  - test
test:
  stage: test
  needs: []
  image: node:20
  script:
    - |-
      # Run tests
      npm test
Step 3

Work Through the Notes

Anything that could not move over cleanly is listed in the comment block at the top of the file. The usual items:

•
Secrets: Add each secret the workflow read as a masked CI/CD variable.
•
Marketplace actions: Swap the placeholder echo for the commands the action ran.
•
Schedules: GitLab keeps cron schedules outside the file; create them under Build > Pipeline schedules.
•
Images: Jobs without a setup action get a plain ubuntu image, which has far fewer tools than a GitHub runner. Pick an image that has what your scripts call.
Step 4

Commit the File to GitLab

•
Download: Click "Download" to save .gitlab-ci.yml.
•
Commit: Put it in the root of the repository, next to your README.
•
Check: Open Build > Pipeline editor; it validates the file before the first run.
•
Run: Push a commit and compare the first pipeline with the last GitHub run.
# Add the CI config to your repo
git add .gitlab-ci.yml
git commit -m "Add GitLab CI pipeline"
git push origin main

Frequently Asked Questions

What does the converter map, and what is left to me?

push, pull_request, schedule and workflow_dispatch become workflow: rules, each job keeps its needs, strategy.matrix becomes parallel: matrix, services keep their image and env, actions/cache becomes cache:, upload-artifact becomes artifacts:, and setup-node, setup-python, setup-go, setup-java and setup-dotnet pick the job image (node:20, python:3.12 and so on). Marketplace actions, job outputs, reusable workflows and anything else without a GitLab match is listed in a comment block at the top of the file, with the job and step it came from.

Why does every job get its own stage and needs: []?

GitHub starts every job that has no needs at the same time and only waits where needs says so. GitLab runs stages one after another unless a job has needs:, so each job gets a stage in dependency order plus a needs list (empty when it waits for nothing). That keeps the same start order you had on GitHub.

How are secrets and ${{ }} expressions handled?

A reference like ${{ secrets.NPM_TOKEN }} becomes $NPM_TOKEN, and common contexts are rewritten too: github.sha becomes $CI_COMMIT_SHA, matrix.node becomes $NODE, inputs become pipeline variables. You still create the secrets yourself under Settings > CI/CD > Variables, ideally masked. Expressions with no GitLab counterpart, such as steps.x.outputs.y, stay as typed and are named in the notes.

What happens to if: conditions?

A job-level if: becomes rules:, for example github.ref == 'refs/heads/main' turns into $CI_COMMIT_BRANCH == "main" and always() becomes when: always. GitLab has no per-step conditions, so steps with if: always() or failure() move to after_script:, and other step conditions are left out with an echo in their place and a note telling you which ones.

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

No. Script text and env values keep the exact characters you typed, so 8901240544102066246, 00501, 14.50, yes and 2024-01-15 come out unchanged. Values a YAML reader could turn into a number, boolean or date are quoted in the output.

Does it check that GitLab will accept the file?

It writes valid YAML in the shape GitLab expects, but it does not run GitLab's own lint. After you commit the file, open Build > Pipeline editor in your project; it validates the configuration and shows the merged result before anything runs.

Is my workflow uploaded anywhere?

No. The conversion runs in your browser, nothing is sent to a server or kept, and a reload brings back an empty editor.

Going the other way? The GitLab CI to GitHub Actions converter does the reverse, and the same workflow can also become an Azure Pipelines, CircleCI or Travis CI config.