Training

GitHub Actions

Chaos Creeps In

Even the best teams drift. Rules are forgotten, naming conventions slip, and documentation falls behind. Left unchecked, every project trends toward disorder. Chaos doesn’t arrive suddenly — it creeps in quietly with each rushed commit and skipped review.

Automation Restores Order

GitHub Actions transforms your rules into code. Every push and pull request becomes an opportunity to check structure, test logic, and protect quality automatically. With automation guarding the boundaries, consistency stops depending on memory and starts depending on design.

Introduction & Setup

Chaos Creeps In

Entropy is real. Repos grow, rules drift, quality slips. Left alone, small inconsistencies become real problems.

Automation Restores Order

Consistent, automatic checks keep work tidy, repeatable, and easy to teach. GitHub Actions is your lightweight rule engine that runs when things change.

Training Goals

  • Understand what GitHub Actions is and why it is useful

  • See how automation can respond when changes happen in a repository

  • Create and run a simple workflow that performs an automatic task

  • Recognize how automation supports consistency, organization, and reproducibility

GitHub Actions lets you define small, repeatable chores that run for you when something happens in your repository. For example, when someone pushes a change or opens a pull request, your workflow can check spelling, lint Markdown, or build a site. You describe the chore in a short YAML file in .github/workflows/. GitHub hosts the work for you. You get results right on the pull request, which encourages teams to keep standards high without extra meetings or manual checks.

Training Resources

This single page is intended to jump-start your exploration of GitHub Actions. To do the training, fork the following repository:

What Are GitHub Actions?

GitHub Actions lets you automate work in your repository when something happens. You describe a workflow in YAML, save it under .github/workflows/, and GitHub runs it in a clean environment. The results appear as checks on commits and pull requests so teams get fast, repeatable feedback.

An example of how this works:

  1. You push a change or open a pull request (an event).
  2. A workflow listens for that event and starts a job on a runner.
  3. The job executes a series of steps, each step runs an action or a shell command.
  4. The run produces logs, checks, and optional artifacts you can download.

     Core Vocabulary (learn these first)

    • Workflow: YAML file that defines when to run and what to do.

    • Event: Trigger that starts a workflow (e.g., push, pull_request, schedule).

    • Job: A group of steps that runs on a runner (can run in parallel or sequence).

    • Step: A single action or shell command inside a job.

    • Action: Reusable unit of work (e.g., actions/checkout@v4).

    • Runner / Runner image: The VM that executes your job (e.g., ubuntu-latest).

    • Check: Pass/fail status shown on commits and pull requests.

    • Artifact: Files saved from a run (reports, build outputs).

    • Secrets: Encrypted values available to jobs without exposing them in logs.

    • Permissions: Repo access granted to the workflow via the permissions: block.

    Useful next:

    • Context: Read-only data for expressions (e.g., github.ref, github.actor).

    • Expression: Logic inside ${{ }} for conditions/inputs (e.g., if:).

    • Environment variables (env:): Key–value pairs available to steps.

    • Matrix: Run the same job across variants (e.g., multiple Node versions).

    • Cache: Saved dependencies to speed up builds.

    • Concurrency: Prevent or cancel overlapping runs of the same workflow.

    Learning by Example

    Use these small workflows to learn by doing. Each exercise takes just minutes.

    Hello Workflow

    Markdown Lint

    Permissions Minimum

    Python Tests

    Node CI

    Artifact Demo

    Run Only When Files Change

    PR Labeler

    Reusable Markdown Lint (callee)

    Call Reusable Markdown Lint (caller)

    Scheduled Maintenance

    Inactivity Watchdog

    ADR Policy Check (advanced)

    Purpose: discuss policy as code outside class time. Because this is an advanced topic and the implementation is long, inspect the file via the GitHub repository.
    Try it: skim the structure and talk about when to gate merges on policy.

    Save Time with Free Marketplace GitHub Actions

    Save time by starting with proven Actions from the GitHub Marketplace. Filter for free and verified publishers, skim recent release activity, then pin to a stable version and keep permissions minimal. Explore the curated Actions below, choose the one that matches your need, and drop its example YAML into your workflow to get value fast.

    GitHub Action Ideas

    TODO expiry nudge
    Add a comment when a TODO older than 30 days is found in a PR diff.
    Triggers: pull_request. Hints: scan changed files, parse dates, post comment. Permissions: pull-requests write.

    Conventional commits gate
    Fail the check if the PR title is not a valid Conventional Commit.
    Triggers: pull_request. Hints: regex on title, short error message with examples.

    PR size budget
    Warn when a PR adds more than N lines. Encourage smaller reviews.
    Triggers: pull_request. Hints: use changed-files to get stats, post a summary.

    Enforce CODEOWNERS review
    Block merge if paths owned by a team lack an approving review
    Triggers: pull_request. Hints: read CODEOWNERS, compare reviewers. Pair with branch protection.

    Docs spell check on demand
    Run spell check only when .md files change.
    Triggers: pull_request with paths: filter. Hints: reusable action, custom dictionary file.

    Lint workflow YAML
    Validate files in .github/workflows/ with actionlint.
    Triggers: pull_request. Hints: actionlint action or container, fail fast with clear output.

    License header audit
    Fail if modified files are missing an SPDX header.
    Triggers: pull_request. Hints: grep each changed file, allow a skip pattern, show a quick fix.

    Coverage threshold
    Upload coverage and fail if total falls below a target.
    Triggers: push and pull_request. Hints: parse coverage summary, job outputs for pass or fail.

    Dependency risk check
    Run dependency review and fail on known vulnerabilities above a chosen severity.
    Triggers: pull_request. Hints: use actions/dependency-review-action, link to the report.

    Nightly smoke test
    Run a minimal test suite at 02:00 UTC even if no code changed.
    Triggers: schedule. Hints: short test command, artifact with timestamp, alert only on failure.

    Get Free Actions

    Browse curated, no-cost Actions to lint, test, build, and publish. Start here when you want a ready-made building block.

    Actions Cheat Sheet

    Concise quick reference for syntax, triggers, contexts, and common job patterns. Handy printable one-pager.

    Starter Workflows

    Drop-in CI templates from GitHub. Good patterns for Node, Python, Docker, Pages, and more to save you time.