GitHub Actions runs any script you can write when something happens in your repository, such as a push, a pull request, a schedule or an API call. That matters because each run holds credentials for your repository, so whoever can start a run can use them. In 2026 GitHub changed both how you pay for runs and how it guards them.
A two-job workflow, and which copy of it runs
Here is a small workflow. Save it as .github/workflows/ci.yml in a repository and push it.
name: ci
on:
push:
branches: [main]
pull_request:
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- run: git log -1 --format=%H
report:
needs: test
runs-on: ubuntu-latest
steps:
- run: echo "Both test jobs passed."
A push to main or any pull request starts one run of this file. The matrix turns test into two jobs, one per operating system, and they run at the same time. report waits for both because of needs: test, and GitHub skips it if either of them fails (workflow syntax).
Now predict. A contributor forks the repository, edits ci.yml in the fork to add a step, and opens a pull request. Which ci.yml does the pull request’s run use: the one on main, or the contributor’s edited copy?
It uses the contributor’s copy. For every event, GitHub reads the workflow files at the event’s own commit (workflows). For pull_request, that commit is the pull request’s merge commit, refs/pull/N/merge (events that trigger workflows).
GitHub limits what that run can do instead. It gets no secrets, its token is read-only, and a first-time contributor’s run may wait for a maintainer’s approval.
Rule: A workflow file travels with the commit that triggers it.
What happens between a push and your first step
This section follows one event from GitHub’s servers to the shell that runs your step.
GitHub picks workflow files from the event’s commit
Every event carries a commit SHA and a Git ref. GitHub searches .github/workflows at that commit and creates a workflow run, one execution of one workflow file, for each file whose on: matches the event. It sets GITHUB_SHA and GITHUB_REF from the same commit (workflows).
Some events break this pattern. schedule, workflow_run and repository_dispatch fire only if the workflow file exists on the default branch, and their GITHUB_SHA is the last commit there (events). So a schedule you add on a feature branch does not run until the file reaches the default branch.
Jobs form a graph, and needs only orders it
Jobs in a run start in parallel unless needs makes one wait for another. If a needed job fails or is skipped, every job after it in the chain is skipped too, unless it uses a condition such as if: always() (workflow syntax).
needs passes no files. A job hands data forward as job outputs, strings that a later job reads from needs.<job>.outputs. They are limited to 1 MB per job and 50 MB per run. To move files between jobs, you upload and download them as artifacts.
Jobs share no filesystem either. Each job on a GitHub-hosted runner gets a new virtual machine, except on the single-CPU ubuntu-slim runner, which runs jobs in containers (GitHub-hosted runners). A file that one job writes to disk is gone when the next job starts.
How a GitHub Actions runner gets a job
A runner is the machine that executes a job, together with the actions/runner application installed on it. The application runs as two processes. Runner.Listener lives as long as the runner and asks GitHub for work. Runner.Worker starts fresh for each job and talks to the listener over anonymous pipes (JobDispatcher.cs, runner source at commit 7afce9e).
GitHub Runner machine
------ --------------
Runner.Listener (long-lived)
Broker <-- 1. long poll ---------------- |
Broker --- 2. job reference -----------> |
Broker <-- 3. acknowledge -------------- |
Run Service <-- 4. acquire the job ---------- |
Run Service --- 5. full job message --------> |
| 6. start one Worker,
v talk over pipes
Runner.Worker (one per job)
Results <-- 7. live log lines over a WebSocket,
then the full log files
The listener long-polls the broker, a GitHub service that holds messages for runners; the docs call this an HTTPS long poll (Actions Runner Controller). The broker’s message is only a reference: a request ID and the address of a second service, the Run Service. The listener acknowledges it, fetches the full job from the Run Service, and hands that job to a new Worker (Runner.cs). A comment in that file says the two services talk to each other asynchronously, so the runner expects some “job not found” and “already acquired” errors.
While the job runs, the Worker sends console lines every 250 to 500 ms over a WebSocket and uploads the step logs to a results service (JobServerQueue.cs).
What the runner model means for self-hosted machines
Every connection starts from the runner, so a self-hosted runner needs only outbound HTTPS on port 443 (self-hosted runners reference). You open no inbound port, and the same model lets GitHub hand your machine any job that matches its labels. The docs say self-hosted runners “should almost never be used for public repositories”. Anyone can open a pull request there, and a runner that is not ephemeral can stay compromised (secure use).
A self-hosted machine is not required to start clean for each job (self-hosted runners). Register it with --ephemeral and it takes one job, then de-registers. Actions Runner Controller (ARC), a Kubernetes operator, runs such one-job runners as pods (ARC).
How uses: turns into code on the runner
Before the first step runs, the Worker sends the job’s action references to GitHub. For each one, the server returns the resolved repository, an exact commit SHA, a download URL and a short-lived download token (ActionManager.cs). The Worker logs “Download action repository” with that SHA, then downloads and unpacks the archive. So @v4 becomes a commit on GitHub’s servers at the start of every job, and a tag that someone moves changes what your next job runs.
Every action is defined by an action.yml file, and it comes in one of three kinds (custom actions). A JavaScript action runs directly on the runner with the runner’s own Node.js. A Docker container action runs only on Linux runners, and it starts slower because the image is built or pulled first. A composite action is a list of steps that runs as a single step inside the calling job.
All JavaScript actions now run on Node 24. GitHub removed Node 20 from its runners on 2026-09-23 (changelog). The runner executes every JavaScript action with Node 24, whatever its runs.using says (HandlerFactory.cs). The metadata syntax docs still list node20 as a valid value, and such an action still loads, but it runs on Node 24.
The token each job carries
Before each job begins, GitHub mints a GITHUB_TOKEN for it: a GitHub App installation token scoped to the workflow’s repository. It expires when the job ends, after at most 6 hours on GitHub-hosted runners; on self-hosted runners it can be refreshed for up to 24 hours (GITHUB_TOKEN).
Its scopes come from a chain: the enterprise, organization or repository default, then the workflow’s permissions:, then the job’s permissions:, then the downgrades for fork pull requests. Once you list any scope, every scope you did not list becomes none (workflow syntax).
Events that this token causes do not start new runs, which stops a workflow from triggering itself in a loop. workflow_dispatch and repository_dispatch are exceptions and always start runs. Since 2026-06-11, a pull request opened, updated or reopened with the token also starts a run, but that run waits until a user with write access approves it (changelog).
Each step runs in a new shell
Each run: step is a new process and a new shell, so export in one step is gone in the next (workflow syntax). The runner creates a fresh file for each step and puts its path in GITHUB_ENV, GITHUB_OUTPUT and a few similar variables. After the step ends, the runner reads the file and applies it (workflow commands, FileCommandManager.cs).
# Excerpt: the steps of one job
steps:
- id: version
run: |
export BUILD=from-export
echo "BUILD=from-env-file" >> "$GITHUB_ENV"
echo "tag=v42" >> "$GITHUB_OUTPUT"
- env:
TAG: ${{ steps.version.outputs.tag }}
run: echo "$BUILD $TAG"
The second step sees BUILD=from-env-file, because the exported value died with the first shell. The first step cannot see its own GITHUB_ENV value, since the runner applies the file only after the step ends. The step output needs the step’s id and stays inside the job; to reach another job, you promote it to a job output.
Note: three 2026 additions, one line each.
- Parallel steps:
background: trueandwaitrun up to 10 steps at once inside one job (2026-06-25, changelog). - Concurrency queues:
queue: maxkeeps up to 100 pending runs or jobs in a concurrency group instead of one (2026-05-07, changelog). $/references:uses: $/pathpoints to an action in the same repository at the running commit, with no checkout (2026-07-30, changelog).
What you can build on GitHub Actions
Anything you can script can run on these events, and most uses differ only in the trigger and the token. Three terms come up in the table below. OpenID Connect (OIDC), in Actions, is a signed token that GitHub issues to one job, which a cloud provider can exchange for short-lived credentials (OIDC). A job needs id-token: write to request it, and that permission allows nothing else.
An artifact attestation is a signed record that links a file to the repository, workflow, commit and trigger that built it (artifact attestations). GitHub’s docs rate it against SLSA v1.0, a scale of build-security levels: attestations alone reach Build Level 2, and building in a shared reusable workflow reaches Build Level 3.
| Use case | Trigger | How it works |
|---|---|---|
| CI across systems and versions | push, pull_request |
A matrix expands one job into combinations, up to 256 jobs per run. fail-fast cancels the rest when one fails (matrix how-to, limits). |
| Cloud deploys without stored keys | push to the default branch |
The job requests an OIDC token, and the cloud checks its sub claim before returning a short-lived token (OIDC reference). For repositories created, renamed or transferred after 2026-07-15, the default sub includes owner and repository IDs (changelog). |
| GitHub Pages | push |
actions/deploy-pages sends the job’s OIDC token to the Pages API, which checks the ref so the deploy respects branch protection. The job needs pages: write and id-token: write (Pages docs, deploy-pages). |
| Container images on GHCR | push to a release branch, or release: published |
The job logs in to ghcr.io with GITHUB_TOKEN and needs packages: write (publishing images). |
| Build provenance | The build’s own trigger | actions/attest signs an attestation for a file or image. Consumers check it with gh attestation verify (how-to). |
| Scheduled jobs | schedule |
Five-field cron, UTC unless you add an IANA timezone: (since 2026-03-19). Runs on the default branch’s latest commit (events, changelog). |
| Manual and external starts | workflow_dispatch, repository_dispatch |
The Run workflow button or gh workflow run takes typed inputs. Other systems call POST /repos/{owner}/{repo}/dispatches with an event_type and a client_payload (REST docs). |
| Repository automation | issues, pull_request, issue_comment |
A job with issues: write runs gh issue edit with GITHUB_TOKEN to label new issues (labeling tutorial). |
| Dependency updates | Run by GitHub | GitHub runs the jobs that open Dependabot pull requests on Actions, even when Actions is disabled. On standard and self-hosted runners they cost nothing (Dependabot on Actions). |
Each row has a cost. An attestation protects nothing until someone verifies it; the docs say generating one alone gives no security benefit. An OIDC trust policy is only as narrow as its conditions, and AWS requires at least one (OIDC in AWS). A schedule needs the file on the default branch, as the section on workflow files showed.
Two GitHub features moved in opposite directions in 2026. The Copilot coding agent runs by default in a separate cloud sandbox since 2026-10-28, and uses Actions only with self-hosted runners or a copilot-setup-steps.yml file (changelog). GitHub Agentic Workflows, generally available the same day, compile Markdown instructions into standard Actions YAML that runs on Actions runners (changelog).
What a run costs in money, limits and risk
Included usage is now a dollar amount
Each plan includes a dollar amount of compute per month, not a number of minutes: $12 on Free, $18 on Pro and Team, and $300 on Enterprise Cloud (included usage). The docs say $300 covers 50,000 minutes of standard Linux at $0.006 a minute, so $12 still buys 2,000 Linux minutes (Actions billing). Windows and macOS spend the same dollars faster, at $0.010 and $0.062 a minute for the standard sizes (runner pricing).
Standard runners in public repositories and all self-hosted runners cost nothing and do not draw from the included amount. Larger runners are billed even in public repositories. Each job is rounded up to a whole minute.
On 2026-01-01 GitHub cut hosted runner prices “by up to 39%” (changelog). The archived 2025 price table lists Linux 2-core at $0.008 and Windows 2-core at $0.016. Against today’s $0.006 and $0.010, that is a 25% and a 37.5% cut, and 37.5% is the largest cut those two tables show.
The same post announced a $0.002 a minute charge on self-hosted runners in private repositories from 2026-03-01. GitHub postponed it soon after, to “re-evaluate our approach”, while the hosted price cut went ahead. As of 2026-11-18 the billing docs list self-hosted runners as free, and GitHub has given no new date.
Schedules and history have limits
A schedule runs at most every 5 minutes. Under high load, especially at the top of the hour, runs are delayed, and the docs say some queued jobs may be dropped (events). In public repositories, GitHub disables scheduled workflows after 60 days without repository activity.
Run history now follows your retention setting too. Since 2026-10-01, the artifact and log retention period also deletes checks, workflow runs and commit statuses, including those from third-party tools (announcement, changelog). Public repositories can keep them for at most 90 days, and the change is not retroactive.
The security cost of running on repository events
The opening example showed that a pull request can change the workflow that tests it. A fork’s run is limited only because it gets no secrets and a read-only token (secure use).
pull_request_target removes that protection. It runs in the base repository’s context, with secrets and a write token, even for a fork. A pwn request is a pull_request_target workflow that checks out the fork’s code and runs it, which hands those secrets to the fork’s author. The docs warn never to check out untrusted code there, and note it can also poison the cache.
Script injection is the second pattern. GitHub expands ${{ }} expressions into the script text before the shell starts, so a pull request title that contains shell syntax becomes part of your command. The fix is to pass the value through env: and use the quoted shell variable, such as "$TITLE" (secure use).
Third-party actions are the third. On 2025-03-11, reviewdog/action-setup@v1 was compromised between 18:42 and 20:31 UTC (advisory). CISA says this “potentially enabled” the compromise of tj-actions/changed-files days later (CISA alert). There, the attacker moved existing version tags to a malicious commit that dumped the Runner.Worker’s memory and printed the secrets to the logs (advisory).
More than 23,000 repositories used tj-actions/changed-files (advisory), and in public repositories the logs, and so the secrets, were public. The tag-to-commit lookup at job start ran the new commit everywhere. CISA added both CVEs to its Known Exploited Vulnerabilities catalog, CVE-2025-30066 on 2025-03-18 and CVE-2025-30154 on 2025-03-24 (KEV feed).
The 2026 guardrails, and the alternatives to Actions
What GitHub changed to close these gaps
- 2025-12-08:
pull_request_targetalways uses the workflow file and checkout commit from the default branch, whatever the pull request’s base branch. Before, old vulnerable workflows on other branches could still be triggered (changelog). - 2026-06-18:
actions/checkoutv7 refuses to check out fork code inpull_request_target, and inworkflow_runstarted by a pull request. The fix was backported to floating major tags such as@v4, enforced from 2026-07-20. Workflows pinned to a SHA or to a minor or patch version did not get it (changelog). - 2026-06-26 and 2026-09-10: untrusted triggers that run in the default branch’s scope get read-only cache tokens (changelog). Cache mode is a
cache-mode:key (read,write,write-onlyornone) that the cache service enforces for a workflow or job (changelog). - 2026-09-17: workflow execution protections, rules on which actors and events may start runs, became generally available (changelog).
- 2026-10-28: workflow lockfiles became generally available. A lockfile,
.github/workflows/actions.lock, pins every action, including the actions they call, to a commit, while your YAML keeps readable tags (changelog). - 2026-12-02:
pull_request_targetis blocked by default in every public repository unless an Actions event policy, one of the workflow execution protection rules, allows it. Private and internal repositories are not affected (changelog).
Each guardrail has a gap. Checkout v7 does not stop git or gh commands in a run: step from fetching fork code. A lockfile does not pin calls to reusable workflows (lockfile docs). GitHub also warns that lockfiles “don’t determine whether a dependency is safe”, so a lockfile pins a malicious commit as firmly as a good one.
Other CI systems, and when each one is the better choice
The systems below differ from Actions in where the control plane lives, who owns the machines, and how the pipeline is defined.
| System | Model | How you pay | The choice flips to it when |
|---|---|---|---|
| GitLab CI/CD | .gitlab-ci.yml in the repository; GitLab-hosted runners use a fresh VM per job, or you run your own |
Compute minutes with a cost factor per runner size; 400 a month on Free | You want CI built into a forge you can host yourself, GitLab Self-Managed |
| Buildkite | Hosted control plane, agents on your machines or Buildkite’s; a script can add steps at run time | $30 per active user a month on Pro; 10 self-hosted agents included, then $3.50 each a month | The pipeline’s shape depends on what changed, and a fixed YAML graph cannot express it. Job logs still go to Buildkite, so source or secrets in them leave your network |
| Jenkins | Self-contained open source server; a Jenkinsfile built from plugins |
Free software; you pay for and run every machine | Nothing may run on a vendor’s service. The project offers no hosted version, so upgrades and plugins are your work |
| Azure Pipelines | Microsoft-hosted agents get a fresh VM per job; its GitHub-hosted agents run on the same infrastructure as Actions larger runners | Parallel jobs (concurrency), with a free tier of at least one | Your organization already runs on Azure DevOps. The Actions runner’s source still carries Azure DevOps names |
| Dagger | Pipeline logic in Go, Python, TypeScript and other languages, run in containers, the same way locally and in CI | Open source engine (docs) | You want to run the exact pipeline on a laptop. Actions YAML shrinks to a trigger that calls Dagger, so you maintain two layers |
| Depot, Blacksmith | Keep Actions and change the runs-on label; to GitHub they are self-hosted runners on the vendor’s machines |
Depot bills per second, $0.006 a minute after its included minutes; GitHub charges nothing for self-hosted runners | Hosted runner speed or price is the problem and the Actions model is not. Both work only for organization repositories, and your code and secrets run on a third party’s machines |
A hardened workflow to start from
This skeleton applies the guardrails above to a test job and a deploy job. It is an excerpt: replace the placeholders, the scripts and the AWS action version before you use it.
# Excerpt: placeholders in <angle brackets>
name: ci-and-deploy
on:
pull_request:
push:
branches: [main]
permissions: {}
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
- name: Show the pull request title
if: github.event_name == 'pull_request'
env:
TITLE: ${{ github.event.pull_request.title }}
run: echo "Testing: $TITLE"
- run: ./scripts/test.sh
deploy:
needs: test
if: github.event_name == 'push'
runs-on: ubuntu-latest
environment: production
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v7
- uses: aws-actions/configure-aws-credentials@<version from the AWS guide>
with:
role-to-assume: <ROLE_ARN>
aws-region: <REGION>
- run: ./scripts/deploy.sh
Notice four things. permissions: {} at the top gives every job no scopes, and each job lists only what it needs, so only deploy can request an OIDC token. The cost is that a job missing a scope gets none for it and fails at the API call.
The pull request title reaches the shell through env:, so shell syntax in it stays data. deploy has no stored cloud keys: AWS trusts the job’s OIDC token if its sub matches the role’s trust policy. With the production environment, the default sub is repo:ORG/REPO:environment:production, or the ID-based form for newer repositories; github/actions-oidc-debugger prints the claims your job receives (OIDC reference).
The lockfile is not in the YAML. You generate .github/workflows/actions.lock with the gh actions-lock extension and commit it next to the workflow, and Dependabot updates it (lockfile docs). Once a workflow is onboarded, every action it uses must be in the lockfile, so adding a step also means regenerating the lock.
To try the shell logic before you push, run the workflow locally with act, which runs jobs in Docker containers. It has no OIDC and ignores permissions, so it tests your scripts, not your security settings (not supported in act).
For further reading, these are the primary sources:
- Workflows, workflow syntax and events that trigger workflows
- GITHUB_TOKEN, OpenID Connect and the OIDC reference
- Secure use reference and workflow dependency lockfiles
- Actions limits, Actions billing and runner pricing
- The
actions/runnersource at commit7afce9e, starting withsrc/Runner.Listener/Runner.csandsrc/Runner.Worker/ActionManager.cs - The GitHub changelog for every dated change above
If you want the next article like this one when it comes out, subscribe to the newsletter.
Comments
No comments yet. Ask a question or share what worked for you.