Skip to main content
Lexicon
Lexicon
GitHub Actions

GitHub Actions

Difficulty: Intermediate
5 min read
Updated 2026-08-21

In plain English

Plain definition

GitHub Actions is a feature built into GitHub that lets you automate tasks such as testing code, building software or deploying applications whenever something happens in your repository, like a push or a pull request.

How a workflow is put together

Workflows are defined declaratively in YAML files stored under .github/workflows/ in a repository. Each workflow is triggered by an event (such as push, pull_request, a schedule, or a manual workflow_dispatch) and consists of one or more jobs. Jobs run in parallel by default unless dependencies are declared, and each job executes a sequence of steps on a runner, which is either a GitHub-hosted virtual machine or a self-hosted runner registered against the repository, organisation or enterprise. Steps invoke shell commands directly or reference reusable actions, which are packaged units of automation published to the GitHub Marketplace or referenced from another repository.

Running GitHub Actions day to day

GitHub Actions is commonly used to build, test and deploy software directly from the same repository that hosts the source code, removing the need for a separate CI/CD system in many cases. The decisions that matter in practice include runner selection (hosted versus self-hosted) affecting cost, isolation and available compute; secrets management via encrypted repository, environment or organisation-level secrets; concurrency controls to prevent overlapping deployment runs; and environment protection rules that gate deployment jobs behind required reviewers. Workflow permissions (the permissions key and the repository’s default token permissions) determine what the automatically issued GITHUB_TOKEN can access, which makes it a real security boundary for any workflow that writes to the repository or calls other GitHub APIs.

From workflow file to runner

A workflow file declares triggers, jobs and steps; each job is dispatched to a runner that pulls the job definition, checks out the repository content if instructed, and executes steps in an ephemeral (for hosted runners) or persistent (for self-hosted runners) execution environment. Actions referenced within steps may be JavaScript actions, Docker container actions, or composite actions that bundle other steps. Because self-hosted runners are long-lived and not automatically sandboxed between jobs, they sit at a different point on the trust boundary than ephemeral hosted runners: a workflow that can trigger arbitrary code execution on a self-hosted runner attached to sensitive infrastructure is a serious risk. Let it shape who reviews workflows and what permissions they get; it is more than a matter of convenience.

A minimal test workflow

This workflow runs a test suite on every push to the main branch:

name: CI
on:
  push:
    branches: [main]
jobs:
  test:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v4
      - name: Run tests
        run: echo "replace with your test command"

This workflow checks out the repository, restricts the automatic token to read-only repository access, and runs a placeholder test step. Any real deployment step would additionally need an explicit, reviewed permission scope and, for state-changing actions, an environment protection rule.

Two assumptions that cause trouble

People often assume a self-hosted runner is as isolated as a GitHub-hosted runner. GitHub-hosted runners are provisioned fresh for each job and destroyed afterwards, whereas self-hosted runners may persist state, network access and credentials between jobs unless explicitly reset, which changes the residual risk of running third-party or fork-triggered workflows against them. The second mistake is assuming the default GITHUB_TOKEN permissions are always minimal; the effective default depends on repository and organisation settings, so the permissions block in a workflow should be treated as the authoritative, verifiable statement of access rather than an assumption about defaults.

Other terms you will meet in workflows

  • Continuous integration and continuous delivery (CI/CD)
  • Workflow runner (GitHub-hosted and self-hosted)
  • Reusable action (Marketplace, Docker container, composite)
  • Environment protection rules
  • GITHUB_TOKEN and workflow permissions

Further Reading

The official GitHub Actions documentation has current detail on triggers, runner types, permissions and security hardening. Workflow syntax and default permission behaviour can change, so check them against the version you use before implementing anything.

About this page

Credited to

Dates

Published

Corrections

No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.

Was this useful?

Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.