Skip to main content

GitHub Actions

GitHub Actions is GitHub’s CI/CD automation tool. It can automatically run workflows for building, testing, deployment, and more. Public repositories are free to use, while private repositories come with a monthly free quota.

Basic Concepts

  • Workflow: an automated process made up of one or more jobs
  • Job(Task):a set of steps executed on the same runner
  • Step: a single task, which can be either an action or a shell command
  • Action(Action):reusable smallest unit
  • Runner: the server that executes the workflow

Basic Syntax

Workflow configuration files use YAML and live in the .github/workflows/ directory.

Simplest workflow

Complete example

Trigger events

Push Event

Pull Request Event

Scheduled tasks

Manual trigger

Common actions

Checkout code

Set up Node.js

Set up Python

CachingDependency

Upload build artifacts

Download build artifacts

Automatically publish a release

Create a release

automatically generates Release Notes

Self-hosted Runner

Self-hosted runners let you run workflows on your own servers.

Add a runner

  1. Go to Repository Settings → Actions → Runners → New self-hosted runner.
  2. Follow the prompts to install and configure it on your server.
  3. Start the runner.

Installation(Linux)

Use a self-hosted runner

Label selection

Secrets management

Add a secret

Settings → Secrets and variables → Actions → New repository secret

Use a secret

Matrix builds

Conditional execution

Practical examples

Automatically deploy to a server

Build and push Docker images

Code checks

Best Practices

  1. Use caching to speed up dependency installation.
  2. Use matrix builds for multi-environment testing.
  3. Run jobs in parallel when they are independent.
  4. Use if wisely to save resources with conditional execution.
  5. Protect secrets and never print them in logs.
  6. Prefer official actions because they are more reliable and better maintained.
  7. Limit permissions and grant only what each workflow needs.
  8. Have a CI fallback plan — GitHub Actions outages happen regularly; consider self-hosted runners or a secondary CI platform.

Platform Reliability Risk

GitHub Actions has experienced frequent outages in 2025–2026. Mitchell Hashimoto (creator of Vagrant and Terraform, GitHub user #1299 since 2008) announced in April 2026 that his open-source project Ghostty is leaving GitHub, primarily because of persistent CI/CD reliability issues:
“I started marking each day with an X if GitHub outages affected my work. Nearly every day had an X.”
When your CI/CD platform has regular outages that block you for hours, it becomes a productivity risk — not just an inconvenience. For serious projects, consider:
  • Self-hosted runners as a fallback (see the Self-hosted Runner section above)
  • Alternative CI platforms (CircleCI, Buildkite, Gitea Actions)
  • Mirror your repo to another platform so you can switch CI quickly
  • Don’t couple your entire workflow to one platform’s availability

Mitigation Strategies

  1. Self-hosted runners — Run workflows on your own infrastructure; unaffected by GitHub outages
  2. Multi-platform CI — Mirror critical workflows to an alternative (CircleCI, Buildkite)
  3. Local testing first — Run lint/typecheck/test locally before pushing; CI should be a gate, not a bottleneck
  4. Cache aggressively — Reduce job duration so outages cause less blocked time
  5. Read-only GitHub mirror — Keep your source on GitHub for discoverability, but host CI elsewhere

References

Last modified on April 29, 2026