GitHub Actions

Pipelines that live next to your code, trigger on every push, and ship to the cloud without storing a single long-lived secret.

git push EVENT workflow.yml .github/workflows job: lint job: test job: build job: deploy needs: build prod OIDC
Workflow Event → Jobs (in parallel) → Deploy → Environment

A small team starts a new project on GitHub. They want CI. They look at the options.

Setting up Jenkins means a server, an SSL cert, a database, plugin patching, backups. GitLab CI means moving the repository. The newer SaaS options need accounts, credit cards, third-party reviews. The team groans — they just wanted tests to run.

Then they notice: GitHub itself has a CI service built in. A YAML file in .github/workflows/ and on every push the tests run, the build happens, and the result appears as a check on the pull request. No new servers. No new credentials. The CI is the repository.

That’s GitHub Actions. It is now the default CI on open source and on a growing majority of new private projects.

01What is GitHub Actions?

GitHub Actions is the CI / CD platform built into GitHub. Workflows live as YAML files inside your repository, in .github/workflows/. They run on events: pushes, pull requests, scheduled times, manual triggers.

The simple version

GitHub Actions is "scripts that run automatically when something happens in your repository". A push happens; a script builds and tests. A pull request opens; a script runs the linter. A tag is created; a script publishes a release.

The structured version

A workflow is a YAML file. It defines one or more jobs. Each job runs on a runner (a virtual machine). Each job has steps. A step runs a shell command or invokes a reusable "action" from the marketplace.

The ecosystem version

Twenty thousand pre-built actions on the marketplace. Want to set up Node? One line. Deploy to AWS? One line. Comment on a PR? One line. The marketplace is the moat.

02The hierarchy: workflow → job → step

Six words. Once you can use them confidently, you can read or write any GitHub Actions workflow.

  • workflowA YAML file in .github/workflows/. One file, one workflow. A repo can have many.
  • eventWhat triggers it: push, pull_request, schedule, workflow_dispatch (a manual button), workflow_call (called by another workflow).
  • jobA unit allocated to a single runner. Jobs in the same workflow run in parallel by default. Use needs: to make one wait for another.
  • stepA single command or action call. Steps inside a job run sequentially.
  • runnerThe machine that executes the job. GitHub-hosted (clean VM, free quota) or self-hosted (your own hardware).
  • actionA reusable step from the marketplace or your own repo. Versioned (e.g. actions/checkout@v4).

03Why GitHub Actions has eaten the world

Five things changed when GitHub launched Actions in 2019. Together they made it the default CI for a generation of new projects.

Reason 01

Zero setup

If your code is on GitHub, you already have a CI server. Add a YAML file and you have a pipeline. No new account, no new server, no procurement.

Reason 02

The marketplace

Twenty thousand reusable actions. Most common tasks are one line. "Set up Python 3.12", "deploy to S3", "post to Slack", "create a GitHub release".

Reason 03

Free for open source

Generous free minutes for public repositories. The reason almost every popular open- source project now uses Actions for CI.

Reason 04

OIDC out of the box

Cloud authentication without storing long-lived keys. The workflow asks GitHub for a short-lived JWT, the cloud verifies it, the workflow gets credentials valid for minutes.

Reason 05

Tight integration with PRs

Checks appear directly on the pull request. Required checks block merge. Reusable workflows let a platform team enforce policy across hundreds of repos.

04A workflow that deploys to AWS via OIDC

Real pipeline. Matrix-tests across three Node versions, then deploys to S3 + CloudFront on main — using a short-lived token, no stored AWS key.

.github/workflows/deploy.ymlYAML
name: deploy

on:
  push:
    branches: [main]
  workflow_dispatch:

permissions:
  id-token: write   # required for OIDC
  contents: read

concurrency:
  group: deploy-prod
  cancel-in-progress: false

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node: [18, 20, 22]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
          cache: 'npm'
      - run: npm ci
      - run: npm test

  deploy:
    needs: test
    runs-on: ubuntu-latest
    environment: production
    steps:
      - uses: actions/checkout@v4

      - uses: aws-actions/configure-aws-credentials@v4
        with:
          role-to-assume: arn:aws:iam::123456789012:role/github-deployer
          aws-region: eu-west-1

      - run: aws s3 sync ./dist s3://prod-static-site --delete
      - run: aws cloudfront create-invalidation --distribution-id E1234 --paths "/*"

05Hosted vs self-hosted runners

A runner is the machine the job runs on. GitHub offers two flavours; each fits a different problem.

GitHub-hosted runners

  • Fresh VM for every job. No state, no leftovers, no patching.
  • 2 vCPU / 7 GB on the standard size; bigger SKUs available.
  • Generous free quota for public repos; pay-per-minute for private.
  • Best for most teams — the boring, default answer.
vs

Self-hosted runners

  • Your hardware. Your network. Your cost.
  • Required for on-prem networks, special hardware (GPUs, Apple silicon), or very large machines.
  • Auto-scaling on Kubernetes with Actions Runner Controller.
  • Treat as untrusted — isolate them; never run jobs from forked PRs on them.

06OIDC — the death of stored cloud keys

Stored AWS / Azure / GCP keys in your CI secrets are the single most common source of cloud breaches. OIDC federation replaces them with short-lived, per-run tokens.

Issue

The workflow asks GitHub for an ID token. GitHub signs a JWT with claims like repo:you/web:ref:refs/heads/main.

Present

The action sends that JWT to AWS / Azure / GCP’s identity service.

Verify

The cloud’s trust policy checks the signature and the claims (issuer = GitHub, repo matches, ref matches).

Assume

The cloud returns temporary credentials — AWS access key, Azure token, GCP access token — valid for an hour or less.

Expire

The credentials die when the run finishes. There is nothing stored to leak, rotate or forget.

07Habits that keep your workflows healthy

GitHub Actions is easy to start with and easy to drift with. These habits keep the workflow simple and secure.

Anti-pattern
Using @main for third-party actions. The author can change main at any time. Pin to a full commit SHA for any action you don’t own.
Anti-pattern
Long-lived cloud keys in repository secrets. A leak, a misconfiguration, a former employee — many ways to lose them. Use OIDC instead.
Anti-pattern
No caching. Every run re-installs every dependency. Use actions/cache or the built-in cache: in setup-* actions; cuts runs by minutes.
Anti-pattern
Running on every push for every job. Use concurrency to cancel superseded runs on the same PR. Saves minutes; saves runner contention.
Healthy
Reusable workflows. workflow_call turns a common pipeline into a shared building block. Platform teams set the policy once; product teams call it.

08Putting it together

Take-aways

1. GitHub Actions is the CI / CD platform built into GitHub. Workflows live in .github/workflows/ as YAML files.

2. The hierarchy is workflow → jobs → steps. Jobs run in parallel; steps run in sequence; actions are reusable steps.

3. Use OIDC instead of stored cloud keys. Pin third-party actions to SHAs. Cache dependencies. Cancel superseded runs.

4. Push reusable workflows to a central repo. Make the right way the easy way.

Next chapter: the tool that creates the cloud the pipeline deploys to — Terraform.