← Dashboard

devops / ci-cd

CI/CD Pipelines: A GitHub Actions Workflow Explained Line by Line

One short, valid CI workflow, read a line at a time, then the free CI/CD services compared by what they actually give you. Action versions and free-tier numbers were checked against the providers' own pages in October 2026.

updated Nov 2026·an 11-minute read·free tiers checked on provider pages

A CI/CD pipeline is a script that a server runs for you every time code changes: fetch the code, install dependencies, run the tests, and report pass or fail on the commit. Continuous integration is the habit of merging small changes often and letting that script check each one. Continuous delivery adds the guarantee that the main branch can be released at any moment, and continuous deployment goes one step further and releases every passing change without a human pressing a button. People searching for "free CI/CD" usually want two answers: what a working pipeline file looks like, and which service will run it without a bill. This page gives both, starting with the file.

01 · THE FILE

A complete CI workflow, line by line

This is a full workflow for a Node.js project. Save it as .github/workflows/ci.yml and GitHub runs it with no other setup. The YAML was parsed with a YAML library, and the action versions were taken from each action's releases page.

.github/workflows/ci.ymlparses as valid YAML
name: CI
on:
  push:
    branches: [main]
  pull_request:
permissions:
  contents: read
jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npm test
What each part does, and what goes wrong without it
LinesWhat it doesWithout it
on: push (main) + pull_requestRuns the job when main changes and when a pull request is opened or updatedWith only push, a broken change is found after it merges. With only pull_request, nothing re-checks main after the merge.
permissions: contents: readLimits the automatic GITHUB_TOKEN to reading the repositoryThe token keeps whatever default your repository settings grant, which is usually more than a test job needs
runs-on: ubuntu-latestPicks a fresh GitHub-hosted Linux virtual machineRequired: a job with no runner never starts
timeout-minutes: 10Cancels a hung job after 10 minutesGitHub's default is 360 minutes, so a stuck test can burn six hours of your quota
actions/checkoutCopies your repository onto the runnerThe runner starts empty, so npm ci finds no package.json and fails
actions/setup-node with cache: npmInstalls Node 22 and restores npm's download cache between runsEvery run re-downloads every package, which adds time to every check
npm ciInstalls exactly what package-lock.json listsWith npm install the lockfile can be rewritten mid-run, so the pipeline may test different versions than you do locally
npm testRuns the test script; a non-zero exit code fails the step and the jobYou have a build server that never tells you anything

Two details in that table are worth confirming from the source. GitHub's workflow syntax reference gives 360 as the default for timeout-minutes. And the npm documentation says npm ci exits with an error if the lockfile and package.json disagree, instead of updating the lockfile. That error is the point: it turns "works on my machine" into a failed check.

02 · WHAT A RUN PRODUCES

From a red check to a blocked merge

Every run attaches a status to the commit: a yellow dot while it runs, a green check when every step exits with zero, a red cross when any step does not. On a pull request that status shows next to the merge button. The check alone only informs people. To make it a gate, mark the job as a required status check in a branch protection rule; GitHub's documentation says that once a check is required, all required checks must pass before changes can be merged into the protected branch.

When a run fails, open the failed step first, not the whole log. The first red step names the cause; later steps are skipped by default after a failure, so they carry no information. Re-run only after reading why it failed. A pipeline that gets re-run until it goes green is hiding a flaky test, not proving the code works.

TIPKeep the first pipeline under five minutes. Short feedback is the whole value of CI. If the job grows slow, split the tests into parallel jobs and cache dependencies before adding more checks. A pipeline people wait ten minutes for is a pipeline people stop waiting for.

03 · WHO RUNS IT FOR FREE

Free CI/CD services compared

"Free" means different things here: free for public repositories, a monthly allowance for private ones, or free software that you host yourself. Numbers below come from each provider's own pricing or billing page.

Free CI/CD options, checked October 2026
ServiceWhat the free option gives youWhere the cost shows up
GitHub ActionsStandard GitHub-hosted runners are free in public repositories. The GitHub Free plan includes $12 of compute usage per month for private repositories, which is 2,000 minutes on a 2-core Linux runner at $0.006 per minute.Usage past the included amount is billed to the repository owner. A 2-core Windows runner is $0.010 per minute and a macOS runner is $0.062.
GitLab CI/CDThe Free tier lists 400 compute minutes per month.The next tier up lists 10,000 compute minutes per month.
CircleCIThe Free plan lists up to 6,000 build minutes and up to 5 active users.Paid plans start at $15 per month and run on credits.
JenkinsMIT-licensed software with no usage limit.You provide and maintain the server it runs on, including updates and security patches.

GitHub now states the included allowance as a dollar amount rather than a fixed number of minutes, so the 2,000-minute figure is our arithmetic ($12 divided by $0.006), not a number GitHub promises. Pick GitHub Actions if your code is already on GitHub; the workflow file above is all you need. Pick GitLab CI if your code lives there. Choose Jenkins when you must run on your own hardware, and expect to spend real time on upkeep.

04 · THE SAFETY LAYER

Tags, tokens and secrets: the pipeline is code that holds keys

A workflow runs other people's code, the actions, with access to your repository and sometimes your deploy credentials. In March 2025 the widely used tj-actions/changed-files action was compromised (CVE-2025-30066), and CISA's alert says the compromise allowed disclosure of secrets including access keys, personal access tokens and npm tokens. Workflows that referenced the action by a movable tag picked up the bad version.

  • Pin third-party actions to a full commit SHA. GitHub's secure-use guide recommends it, because an attacker would need a SHA-1 collision to swap the code behind a SHA. First-party actions/* tags like the ones above are a lower risk but the same logic applies.
  • Keep GITHUB_TOKEN read-only by default and raise permissions per job, as GitHub's guidance suggests.
  • Store credentials as secrets and reference them by name; never write them into the YAML.
WATCHA secret printed to a log is a leaked secret. GitHub redacts registered secrets from logs, but redaction is a safety net, not a plan: its documentation says to mask sensitive values that are not registered secrets with ::add-mask::, and it warns that secrets printed through some workarounds are not redacted. Treat any credential that has appeared in a log or a commit as compromised and rotate it. The full pipeline-security picture, including scanners and supply-chain attestations, is on the DevSecOps page.

05 · SOURCES

References worth reading in full

Official references for the three big platforms. Read the one you will use; the concepts carry across.

The practice behind the tools. These two explain why a team runs a pipeline and how to tell whether it is working.

06 · PRACTICE

Make the pipeline fail on purpose

TRY ITProve the gate works: add the workflow to a small repository with at least one passing test. Push to a branch and open a pull request, then watch the check turn green. Now change an assertion so the test fails and push again. The pull request should show a red cross within minutes. Finally, add the job as a required status check in the branch protection settings and confirm the merge button refuses to proceed. A pipeline you have never seen fail is a pipeline you have not tested.

07 · FAQ

Frequently asked questions

Is GitHub Actions free?

Standard GitHub-hosted runners are free in public repositories, and self-hosted runners are free to use. For private repositories, the GitHub Free plan includes $12 of compute usage per month, and extra usage is billed to the repository owner. GitHub states the allowance as money rather than minutes.

What is the difference between continuous delivery and continuous deployment?

Continuous delivery means every passing change is ready to release, and a person decides when to release it. Continuous deployment removes that decision: every change that passes the pipeline goes to production automatically.

Why use npm ci instead of npm install in a pipeline?

npm ci installs exactly what the lockfile lists and exits with an error if the lockfile and package.json disagree. npm install can update the lockfile, so a pipeline using it may test different dependency versions than you have locally.

Should I pin GitHub Actions to a tag or a commit SHA?

GitHub recommends pinning third-party actions to a full-length commit SHA, because tags can be moved. Pin to a tag only if you trust the action's creator. The 2025 tj-actions/changed-files compromise is the standard example of why.

Which CI/CD tool should I learn first?

Start with the one that sits next to your code. GitHub Actions for GitHub repositories, GitLab CI/CD for GitLab. The ideas are the same everywhere: a trigger, a clean machine, ordered steps and an exit code. Jenkins is worth learning if your employer already runs it.

Where pipelines lead next

A pipeline usually builds an image, applies infrastructure and reports on what it shipped.