Our team runs product code on GitHub and a set of infrastructure repositories on a self-managed GitLab. Engineers move between the two every week, and the most common question in review is some version of "what is the GitLab word for this?" Both systems do the same job: react to a repository event, run commands on a machine, keep some files, and deploy. The vocabulary and a few design choices differ, and those differences are where pipelines break when someone ports a file from one to the other.
This guide maps the concepts side by side, then calls out the five places where the models are not equivalent. Examples use GitHub-hosted runners and GitLab.com, but the same keywords apply to GitHub Enterprise Server and self-managed GitLab.
The vocabulary map
Concept | GitHub Actions | GitLab CI/CD |
|---|---|---|
Config file | Any | One |
Top-level unit | Workflow | Pipeline |
Unit of scheduling | Job | Job |
Ordering |
|
|
Unit inside a job | Step ( | Lines in |
Reusable building block | Action (JS, Docker or composite) | CI/CD component, |
Reusable whole job set | Reusable workflow ( |
|
Machine | Runner (GitHub-hosted, larger, self-hosted) | Runner (instance, group, project) with an executor |
Choosing a machine |
|
|
Job container |
|
|
Event filter |
|
|
Secrets | Secrets + variables (repo, environment, org) | CI/CD variables (project, group, instance), protected/masked |
Files between jobs | Artifacts via |
|
Speed-up cache |
|
|
Deploy target | Environment (protection rules, secrets) | Environment (protected, deployment tiers) |
Manual gate | Environment required reviewers |
|
A minimal pipeline in both
The same test-then-build flow in each system:
# .github/workflows/ci.yml
name: ci
on:
push:
branches: [main]
pull_request:
jobs:
test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm test
build:
needs: test
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
# .gitlab-ci.yml
stages: [test, build]
default:
image: node:22
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
test:
stage: test
cache:
key:
files: [package-lock.json]
paths: [.npm/]
script:
- npm ci --cache .npm --prefer-offline
- npm test
build:
stage: build
script:
- npm ci && npm run build
artifacts:
paths: [dist/]
expire_in: 1 week
Notice what GitLab does without being asked: it checks out the repository for every job, and the build job would automatically receive artifacts from every earlier stage. GitHub does neither implicitly; checkout is an action you call, and artifacts must be downloaded explicitly with actions/download-artifact.
Difference 1: ordering defaults are opposite
GitHub jobs run in parallel unless you add needs:. GitLab jobs run stage by stage unless you add needs:, at which point that job leaves the stage model and starts as soon as its listed jobs finish. Porting a GitHub file that has no needs: into a GitLab file with a single stage gives the same behaviour; porting a GitLab file with five stages into GitHub without adding needs: runs everything at once, including deploy before tests.
There is a second effect in GitLab: once a job uses needs:, it only downloads artifacts from the jobs it lists. Teams adding needs: for speed often lose files they used to get for free. We cover that failure in detail in the post on GitLab needs and missing artifacts.
Difference 2: steps vs one script
A GitHub job is a list of steps. Each step can be a shell command or a packaged action with typed inputs, and each step gets its own log group, status and optional if:. A GitLab job is one script: a list of shell lines executed in order in the same shell session, stopping at the first failing command.
Practical consequences:
Environment changes carry over between lines in GitLab automatically. In GitHub they do not carry between steps unless you append to the
$GITHUB_ENVfile or use step outputs via$GITHUB_OUTPUT.Reuse in GitHub happens at step level (call an action). Reuse in GitLab happens at job level (
extends:,include:, components), or by putting logic in a script file in the repository.The marketplace of actions has no one-to-one GitLab equivalent. Most actions wrap a CLI, so the GitLab port is usually "install the CLI in the image and call it".
Difference 3: runners and how jobs pick them
Both systems use an agent that polls the server for work. GitHub selects runners by labels in runs-on:; hosted runner labels such as ubuntu-24.04 or ubuntu-24.04-arm select a fresh virtual machine per job. GitLab selects by tags:, and the runner's executor (Docker, Kubernetes, shell, instance) decides what "a machine" means.
Two GitLab-specific rules surprise GitHub users:
A runner can be configured to refuse untagged jobs, and a job with tags only runs on a runner that has all of those tags.
A runner can be protected, meaning it only takes jobs from protected branches and tags.
When either rule does not match, the job does not fail; it sits in "pending" with a stuck message. On GitHub the equivalent is a job waiting forever for a self-hosted label nobody serves.
Difference 4: secrets are scoped differently
GitHub secrets live at organisation, repository and environment level. A job gets environment secrets only when it declares environment: production, and environment protection rules (required reviewers, branch restrictions) gate it. Secrets are not passed to workflows triggered from forks.
GitLab variables live at instance, group and project level, with three independent switches: protected (only for protected branches and tags), masked (hidden in job logs if the value meets format rules) and environment scope (only for jobs targeting a matching environment). A protected variable is silently absent in a pipeline on an unprotected branch, which is the classic "deploy works on main, empty credentials on a feature branch" bug.
For cloud access, both now issue OIDC tokens so you can avoid long-lived keys: GitHub through permissions: id-token: write, GitLab through the id_tokens: keyword.
Difference 5: cache and artifacts are separate tools in both, but behave differently
Both systems treat artifacts as job outputs you keep (build results, reports) and cache as a best-effort speed-up. The mechanics differ:
GitHub Actions | GitLab CI/CD | |
|---|---|---|
Cache storage | GitHub-managed, per repository, evicted when unused or when the repo is over its size budget | Runner-local by default; shared only with a distributed cache (S3, GCS, Azure) configured on runners |
Cache key | You build it ( |
|
Overwrite | Entries are immutable per key | Uploaded at job end per policy ( |
Artifacts retention | Default set at repo/org level, override with |
|
A frequent porting mistake is assuming GitLab cache is shared between all jobs the way the GitHub service is. With autoscaled runners and no distributed cache configured, two jobs on different machines never see each other's cache.
Reusable configuration
On GitHub, a reusable workflow is a workflow with on: workflow_call that other workflows call as a job, passing inputs and secrets. A composite action packages steps. On GitLab, include: pulls YAML from the same project, another project, a remote URL or a template; CI/CD components add versioned, typed inputs and a catalog.
# GitHub: call a shared workflow pinned to a tag
jobs:
deploy:
uses: example-org/platform-workflows/.github/workflows/deploy.yml@v3
with:
environment: staging
secrets: inherit
# GitLab: use a component pinned to a version
include:
- component: gitlab.example.com/platform/ci-components/deploy@3.1.0
inputs:
environment: staging
Pin both to an immutable version. A shared workflow referenced by branch name changes under every consumer the moment someone merges.
Porting checklist
When moving a pipeline from one system to the other, walk through this list:
Add explicit ordering (
needs:in GitHub, stages orneeds:in GitLab) and check deploy cannot start before tests.Replace each marketplace action with the CLI it wraps; keep versions pinned.
Rebuild cache keys from lock files; confirm where the cache is stored on the target runners.
List every secret and decide its scope: protected/environment in GitLab, environment secrets in GitHub.
Replace stored cloud keys with OIDC federation while you are at it.
Recreate branch protection and required checks; a renamed job name breaks a required status check.
Common mistakes
Mistake | Why it hurts | Do this instead |
|---|---|---|
Copying GitLab stages to GitHub without | Every job runs at once, deploy included | Add |
Assuming checkout happens in GitHub | Job runs in an empty directory | Add |
Exporting a variable in one GitHub step | Next step does not see it | Write to |
Marking GitLab deploy creds protected, running on a feature branch | Empty variable, confusing auth errors | Deploy only from protected refs, or use environment scopes |
Expecting shared cache on autoscaled GitLab runners | Cache misses on every job | Configure a distributed cache |
Key takeaways
The concepts map almost one to one: workflow/pipeline, job, step/script line, runner, environment.
Ordering defaults are opposite: parallel in GitHub, staged in GitLab.
GitLab does checkout and artifact download implicitly; GitHub makes you ask.
Secrets scoping is where ports break; check protected and environment-scoped variables first.
Pin every reusable workflow, action and component to an immutable version.
References
GitHub Docs, Workflow syntax for GitHub Actions: https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax
GitHub Docs, Reusing workflows: https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows
GitLab Docs, CI/CD YAML syntax reference: https://docs.gitlab.com/ci/yaml/
GitLab Docs, Migrating from GitHub Actions: https://docs.gitlab.com/ci/migration/github_actions/
GitLab Docs, CI/CD components: https://docs.gitlab.com/ci/components/
Comments
0No comments yet. Be the first to comment!
Sign In to post a comment.