Pipelines routinely need sensitive values: API keys for third-party services, database passwords for integration tests, private registry credentials, signing certificates for release binaries, cloud provider access keys for deployment. Hardcoding these values in workflow YAML is a critical security failure — YAML files are committed to Git, version-controlled, potentially public, and visible in pull requests from fork contributors. GitHub Actions secrets provide an encrypted, access-controlled store for sensitive values that are injected into workflow jobs at runtime, masked in log output, and never accessible directly through the GitHub UI after creation. Understanding the secrets hierarchy — repository secrets, environment secrets, and organisation secrets — and their interaction with branch protection and deployment environments is essential for building pipelines that are both functional and secure.
30 minintermediate
Secrets and Encrypted Variables
Analogy🏏Cricket
🏏 Think of it like cricket: A cricket series is structured in three tiers: the series schedule (which matches are played and when), individual match plans (batting order, bowling rotations, fielding strategy), and specific delivery plans (which balls to bowl to which batsman in which over). The series schedule is the workflow — it defines the overall event. Each match is a job — it runs independently but contributes to the series outcome. Each delivery plan is a step — a specific action with a discrete result. Just as a Test captain doesn't redesign the series schedule for every match but does adjust the bowling plan for each innings, GitHub Actions separates what triggers the automation (workflow) from how independent tasks are parallelised (jobs) from the individual commands executed (steps). The insight is that this separation of concerns is what allows large, complex pipelines to remain manageable — just as a well-structured series plan keeps a touring team organised across multiple venues and formats.
Lesson 13 of 24
0% complete