How to Migrate From GitHub Actions to GitLab CI
Actions jobs and needs map to GitLab jobs with stages or needs, uses actions become script steps, and the secrets context becomes CI/CD variables.
Going the other direction, an Actions workflow maps to .gitlab-ci.yml. Jobs become GitLab jobs, needs maps to GitLab needs or stages, uses: actions become script: commands, and secrets.NAME becomes a CI/CD variable.
Concept mapping
| GitHub Actions | GitLab CI |
|---|---|
jobs: + needs: | stages: or needs: |
runs-on: | tags: (or shared runner default) |
uses: actions/setup-node | image: + install script |
run: | script: |
secrets.NAME | CI/CD variable $NAME |
actions/cache | cache: |
Before
.github/workflows/ci.yml
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci && npm testAfter
.gitlab-ci.yml
test:
image: node:20
script:
- npm ci
- npm testWhat does not map cleanly
- GitLab has no marketplace, so every action becomes an explicit tool install or image choice.
- Reusable workflows map to
include:andextends:, which behave differently fromworkflow_call. - Environments and approvals exist in GitLab too but are configured through different keywords.
Related guides
How to Migrate From GitLab CI to GitHub ActionsConvert a .gitlab-ci.yml to GitHub Actions, mapping stages to jobs with needs, script to run, artifacts to up…
CI Concept Mapping to GitHub ActionsA cross-tool mapping of common CI concepts (matrix, cache, artifacts, secrets, services, conditionals, manual…