GITHUB · FOUNDATIONS
GitHub Actions basics: workflows, jobs, runners and permissions
GitHub Actions runs defined processes in response to events and other triggers. Use a proposed SQL change to identify what starts a workflow, where it runs and which privileges it uses. Keep a successful check separate from review, merging and delivery.
Explain events, workflows, jobs, steps and runners, and identify the boundary between untrusted code and privileges.
A PR proposes integration; checks report validation of a particular target. YAML is a configuration format. No live workflow or runner is created here.
What triggers the work, and where does it run?
A trigger; the workflow specifies which events it handles.
YAML defines triggers and one or more jobs.
The runner is the environment; the job is a unit of work on it.
For example: identify the revision, validate a rule, then report.
These labelled areas distinguish triggering from execution; they are not run logs. Multiple jobs can run concurrently or in a dependency sequence.
An event is a trigger, a workflow the overall definition, a job a unit of work, a step an operation within it, and a runner the execution environment. YAML definitions live under .github/workflows. Manual and scheduled triggers also exist. Code and PR titles become input when a runner handles them.
Jobs do not necessarily run serially in YAML order. Dependencies use needs; independent jobs can run concurrently. Distinguish this from step ordering inside a job. Conditions, failures and skips also affect the execution path.
Identify the revision actually tested
Fictional PR #42 proposes H, adding region = JP to an approved-report query. For a normal pull_request event on an open, mergeable PR, the default ref identifies a test-merge target, labelled T here. H and T differ; a trigger alone does not establish which revision was checked out.
| Value | What it identifies |
|---|---|
| GITHUB_REF | The event ref; a test-merge ref for a normal open PR. |
| GITHUB_SHA | The commit associated with that event ref. |
| github.event.pull_request.head.sha | The proposed branch head, distinct from a default test-merge commit. |
Fix the validation scope too: R-A = approved / JP, R-B = approved / US, R-C = pending / JP. The added AND predicate yields the expected set {R-A}. That fixture does not cover a real database’s collation, NULLs, scale or complete business requirements.
Separate GitHub tokens from AWS authentication
| Material | Purpose |
|---|---|
| GITHUB_TOKEN | A per-job token for GitHub operations on the workflow repository; narrow with permissions. |
| OIDC identity token | An identity assertion for an external service; fetching it requires id-token: write. |
| Temporary AWS credentials | Used for AWS API requests after AWS allows role assumption. |
permissions:
contents: readStart with the operations a check actually needs, rather than write-all. In this fragment, unspecified permissions become none and no OIDC token retrieval is granted. Determine the required APIs and organization or event constraints for a real job. GitHub write access does not authorize S3 PutObject.
Keep untrusted input away from privileges
Treat PR code, workflow edits and metadata as untrusted until reviewed. Executing an untrusted PR checkout in a privileged pull_request_target or workflow_run context is dangerous. Assess the code, token, secrets and reachable systems, not merely the event name.
Secrets are sensitive values, and log redaction is not guaranteed. A third-party action is executable code: review its provenance, contents, dependencies and privileges. Pinning a reviewed full commit SHA helps control changes but is not a complete safety guarantee.
What does a successful check establish?
- Identify the tested revision, environment and defined validation.
- Read success, failure or skipped states and check whether the necessary validation ran.
- Keep human review and post-merge build, delivery and behavior separate.
Choose an option to see the result and explanation.
Check, then explain in your own words
- Explain each role from event to job and step.
- Separate source-reading privileges from deployment privileges.
- Distinguish the tested revision from a later artifact.
Check your understanding: Does a successful check of T mean an artifact from M was deployed?
No. Verify the build from integrated M and delivery of that artifact separately.
Completing a defined check of one target does not establish later operations.
Sources and conditions checked
Primary references are collected here with their scope, conditions and corresponding sections. Independent expert review and live-environment validation have not been performed.
- GitHub Actions: WorkflowsChecked:
Scope and conditionsEvents, workflows, jobs, runners and steps. Documentation review, not live-environment validation.
Used in this lessonWhat triggers the work, and where does it run? What does a successful check establish?
- GitHub Actions: Workflow syntaxChecked:
Scope and conditionsJob dependencies with needs, conditions and permissions; no runnable workflow is created. Documentation review, not live-environment validation.
Used in this lessonWhat triggers the work, and where does it run? Separate GitHub tokens from AWS authentication What does a successful check establish?
Scope and conditionsDefault pull_request merge ref versus head.sha for open mergeable PRs; other events and checkout targets differ. Documentation review, not live-environment validation.
Used in this lessonIdentify the revision actually tested What does a successful check establish?
- GitHub Actions: GITHUB_TOKENChecked:
Scope and conditionsPer-job repository-scoped token, distinct from AWS credentials. Documentation review, not live-environment validation.
Used in this lessonSeparate GitHub tokens from AWS authentication What does a successful check establish?
Scope and conditionsIssuer, audience, subject contexts and immutable formats introduced after July 15, 2026; GHES differs. Documentation review, not live-environment validation.
Used in this lessonSeparate GitHub tokens from AWS authentication
Scope and conditionsWeb identity token exchange for temporary credentials without pre-existing AWS credentials for the request. Documentation review, not live-environment validation.
Used in this lessonSeparate GitHub tokens from AWS authentication
Scope and conditionsUntrusted code and privileged contexts, secrets, third-party actions and persistent self-hosted state. Documentation review, not live-environment validation.
Used in this lessonKeep untrusted input away from privileges What does a successful check establish?