GitHub Actions

GitHub bills each job of a workflow by the minute, at its runner's price, and rounds each job up to a whole minute. Tidegate can cap those minutes the way it caps any other spend: each job reserves its minutes before it does any work, a budget grants or denies them, and when the job ends it settles what it used.

Your organization already has a meter for each of GitHub's runners, priced at GitHub's list price (Meters). There are two ways to reserve against them:

  • Tidegate's GitHub App, installed once on your GitHub organization, meters every job in every repository it can see, and cancels the workflow run of a job a budget has no room for. It works from outside your workflows, so no workflow file can turn it off, and nothing in your repositories changes.
  • The action, attunehq/tidegate-action, is a step at the top of each job you want to cap. There's nothing to install, but each workflow has to include it, and a workflow can drop it.

Use the App if your Tidegate has one: the GitHub page, in Settings, says. You can run both while you move from one to the other; each job is counted once.

The GitHub App

GitHub tells Tidegate about each job in the repositories the App is installed on. Tidegate reserves the job's minutes as it's queued, cancels its workflow run if a budget denies it, and settles the minutes GitHub timed once it's done. Each job is a reservation, counted by your budgets and shown on the Spend page like any service's.

Connecting GitHub

On the GitHub page, in Settings:

  1. Install the App on your GitHub organization (or your own account), from the link on the page. GitHub asks which repositories it may see; pick all of them, or the ones to meter.
  2. GitHub sends you back to the page, which offers to connect the installation. Choose the app and environment its jobs spend as, and connect.

Connecting takes an admin of the Tidegate organization whose linked GitHub account is an owner of the GitHub organization the App is installed on (or is the account itself, for a personal one). Link your GitHub account first under Your account, in Settings. Tidegate asks GitHub who owns the installation: a connection puts a GitHub organization's jobs under your budgets, and lets those budgets cancel its runs, so only its owners may make one.

An installation is connected to one Tidegate organization. Connecting makes a spender key named for the GitHub account, which every job reserves through: it shows on the Keys page with when it was last used, and the history records both. Nobody ever holds its secret.

Which meter a job counts on

A job counts on the meter of the runner it ran on.

  • GitHub's standard labels (ubuntu-latest, ubuntu-24.04-arm, windows-2025, macos-15-xlarge, and the rest) map to their runner's meter on their own, such as github.actions-linux.minutes.
  • Larger runners have names your organization chose, such as ubuntu-8core, which don't say their size. Name the meter for each in the connection's settings, such as github.linux-8-core.minutes. Until you do, their jobs aren't metered, and the page lists each such label with how many jobs ran on it this week.
  • Self-hosted runners aren't billed by GitHub, so they're skipped, unless you name a meter for self-hosted in the settings.
  • Public repositories: GitHub doesn't bill standard runners there, so their jobs aren't counted unless you turn that on in the settings. Larger runners are billed, and counted.

A job whose meter your organization removed is skipped, as is one whose budget counts dollars and whose meter has no price.

Estimates

A job reserves its minutes before anyone knows how long it will run. Tidegate learns each job's length as it watches it finish: a job (its repository, workflow, and name, with its matrix values) reserves the second longest of its last ten runs, so one run that hung until its timeout doesn't set every later one's estimate. A job Tidegate hasn't seen finish reserves the connection's default estimate: 10 minutes, unless you set another in its settings.

When the job is done, Tidegate settles it with the minutes GitHub bills: from when its runner started it to when it finished, rounded up to a whole minute. A job that runs longer than its estimate carries its budget past the limit by what it ran over; the jobs after it are denied for it.

What a denial stops

When a budget has no room for a job, Tidegate cancels the job's whole workflow run: GitHub can only cancel runs, not single jobs. It's a plain cancel, so steps that run if: always() still clean up. The cancellation lands a few seconds after the job is queued, so a job whose runner starts first is billed its first minute.

The page

Each connection shows what came of its jobs over the last week: reserved, denied (and their runs cancelled), reserved by the action, not metered, and failed. A failed job is one whose step Tidegate gave up on, such as a cancellation GitHub refused; your Tidegate's operator can see why.

Admins change a connection's settings (the default estimate, whether to count public repositories' standard runners, and the runners' meters) and disconnect it. Disconnecting revokes its key, and revoking the key on the Keys page disconnects it too. Its jobs aren't metered or stopped after that; the reservations it made stay. If the App is uninstalled on GitHub, the page says so.

What it can miss

GitHub doesn't send a notification again if it couldn't deliver it, so a job Tidegate never heard start is reserved when it's seen finishing: counted, but not stopped. A job none of whose notifications arrived isn't counted at all. Your Tidegate's operator can send them again from the App's settings on GitHub.

The action

  1. Make a spender API key, and store it as an Actions secret, such as TIDEGATE_KEY, on the repository or the GitHub organization.
  2. Add the action as the first step of each job you want to cap, and set the job's timeout-minutes to the minutes it reserves:
jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    permissions:
      contents: read
      actions: read
    steps:
      - uses: attunehq/tidegate-action@v1
        with:
          organization: org_0123456789abcdef01234567
          key: ${{ secrets.TIDEGATE_KEY }}
          minutes: 30
          if-unavailable: allow
      - uses: actions/checkout@v4
      # ...

The action finds the job's runner and reserves minutes on its meter. If a budget denies it, the job fails there, naming the budget, and the jobs that need it are skipped. When the job ends, whether it passed, failed, or was cancelled, the action settles the minutes it ran, rounded up as GitHub rounds them.

With timeout-minutes equal to minutes, a job can never run longer than it reserved, so a budget is never overspent by a job it granted. What a denied job still costs is the minute or so GitHub bills for starting it, since a job has to start to ask.

if-unavailable is required, and is yours to choose: whether a job runs (allow) or fails (deny) when it can't ask Tidegate, because Tidegate can't be reached, or because the job has no key. Pull requests from forks get no secrets, so they have no key. A mistake in the setup fails the job whatever you choose, since under allow it would quietly turn metering off: a revoked key, a meter your organization doesn't have, or a larger runner without a meter.

The action needs actions: read to find its job's runner and start time. It reserves nothing for standard runners in a public repository, which GitHub doesn't charge for, unless you set count-free-minutes: true, nor on self-hosted runners, unless you name a meter for them with meter. For a larger runner, name its meter with meter, such as github.linux-8-core.minutes: its labels are your own, so the action can't tell which it is.

With the App

The App and the action reserve the same job under the same id, with the same meter and labels, so a job they both see is counted once: whichever reserves second sees the job is covered and leaves it to the other, and the App's page counts those jobs as reserved by the action.

What each job carries

Each reservation's id is github-actions: and the job's id, and it carries these labels, which budgets can match and split by, and Spend can break spend down by:

LabelWhat it holds
github.repositoryThe repository, such as attunehq/tidegate.
github.workflowThe workflow's file, such as .github/workflows/ci.yml.
github.jobThe job's name as GitHub shows it, with its matrix values.
github.actorWho started the run, by their GitHub login.
github.eventWhat started it, such as push or pull_request.
github.branchThe branch it ran on: a pull request's head branch, or the ref.

The action's labels input adds up to 10 labels of your own, as key=value lines; their keys can't start with github..

Budgets for CI

A budget in dollars over the GitHub meters caps what all your runners cost together, whatever mix of runners your jobs use. Narrow it, or split it:

  • Per person, per day: split by github.actor, with a window of one day. Each person, or each bot or agent opening pull requests, gets the same daily allowance, and one runaway can't spend everyone's.
  • Per repository, per month: filtered by github.repository.
  • Per workflow: filtered by github.workflow, such as a nightly job you want capped apart.

What it doesn't do

The action is advisory, like every use of Tidegate from inside the work it counts: a job that doesn't run it isn't counted. On a pull request from a branch of the same repository, GitHub runs the pull request's own copy of the workflow, so a pull request can remove the step. The App can't be removed that way, but it counts only what GitHub tells it, in the repositories it's installed on. Either way, keep GitHub's own budget on Actions, with "Stop usage" on, as the ceiling nothing gets past; Tidegate caps what GitHub's can't: each person, each workflow, each day.

Spend is counted at GitHub's list prices. GitHub doesn't bill the minutes your plan includes each month, so until you've used those, Tidegate shows more than GitHub charges.