How to Move a GitHub Actions Workflow to GitLab CI
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:
.github/workflows/*.yml into the input editor.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 testWhat the Converter Changes
The output updates as you type. This is how the parts of a workflow line up with GitLab CI YAML:
workflow: rules: on $CI_COMMIT_BRANCH and $CI_MERGE_REQUEST_TARGET_BRANCH_NAME; wildcards turn into regular expressions.needs, so jobs that ran side by side on GitHub still do.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 testWork 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:
Commit the File to GitLab
# Add the CI config to your repogit add .gitlab-ci.ymlgit commit -m "Add GitLab CI pipeline"git push origin mainFrequently 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.
Related Tools
Jenkins to GitHub Actions
Convert Jenkins pipelines (Jenkinsfile) to GitHub Actions workflows — stages, parallel stages, when-conditions, post blocks and environment become jobs and steps, and anything it can't convert is listed in notes
GitLab CI to GitHub Actions
Convert GitLab CI/CD pipelines to GitHub Actions workflows with jobs, artifacts, and variables
CI/CD Pipeline Fixer
Fix broken CI/CD pipeline configurations automatically, repair GitHub Actions, GitLab CI, Jenkins, and Azure Pipelines YAML errors
CircleCI to GitHub Actions
Convert CircleCI config.yml to GitHub Actions workflows with jobs, caching, and artifacts
Azure Pipelines to GitHub Actions
Convert Azure Pipelines YAML to GitHub Actions workflows with jobs, tasks, and stages
Travis CI to GitHub Actions
Convert .travis.yml to GitHub Actions workflows with language support, caching, and lifecycle hooks