feat: self-hosted runner support, private-repos-only by design - #6
Merged
Conversation
macOS Actions minutes bill at 10x and are the portfolio's main CI cost.
This adds the option to run them on owned hardware, with the constraint
that makes that safe built into the workflows rather than left to each
consumer to remember.
Self-hosted runners are for PRIVATE repositories only. A self-hosted
runner is persistent and not reset between jobs; a public repository
accepts pull requests from anyone, and a pull request is a proposal to
run the author's code. Public repositories also get free minutes — so
pointing one at owned hardware takes the whole risk for no saving.
Two independent gates:
- job-level `if:`, which GitHub evaluates before allocating a runner,
so fork pull requests never reach the host;
- actions/assert-trusted-runner, the first step of every job and ahead
of checkout, which re-checks visibility and fork status on the runner
and fails closed when visibility can't be determined.
Visibility is deliberately NOT part of the job-level `if:`: a skipped job
reports success, and a public repository wired to the fleet is a
configuration mistake that has to be loud.
The guard is a no-op on GitHub-hosted runners, which is what lets it sit
in a shared workflow whose defaults stay hosted. Every value it reads is
passed through the environment, never interpolated — a fork can name
itself `$(...)`.
Also:
- `runner` / `release_runner` inputs accept a JSON array of labels,
reusing the startsWith/fromJSON convention ios-release.yml already
used. `release_runner` exists so signing can be routed to a runner in
its own macOS account rather than sharing the CI machine.
- `macos_runner` is deprecated but still wins when non-empty, so no
existing caller changes behaviour. Defaults remain macos-15: the
fleet is opt-in, never inherited.
- On self-hosted runners, setup-xcode is skipped (it re-points the
machine's selected Xcode, which on a shared host would affect every
other repository's builds) and xcodegen is expected preinstalled,
with a clear failure if it isn't.
- The release job's checkout keeps its push credentials, so cleanup now
also unsets them from .git/config on self-hosted hosts, where the
disk outlives the job.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the option to run macOS jobs on self-hosted hardware, with the constraint that makes it safe built into the workflows rather than left to each consumer to remember.
The rule
Self-hosted runners are for private repositories only.
A self-hosted runner is a persistent machine that isn't reset between jobs. A public repository accepts pull requests from anyone, and a pull request is a proposal to run the author's code. Public repositories also get free Actions minutes — so pointing one at owned hardware takes on the entire risk in exchange for nothing.
This is why the migration targets private repos: it captures the whole bill (they're the only ones billed) and removes the untrusted-code surface structurally, rather than via a gate that has to be written correctly in every workflow forever.
Two gates
if:— GitHub evaluates it before allocating a runner, so a fork PR never reaches the host.actions/assert-trusted-runner— first step of every job, ahead of checkout. Re-checks visibility and fork status on the runner itself.Visibility is deliberately not in the job-level
if:. A skipped job reports success, and a public repo wired to the fleet is a configuration mistake that must be loud — so it fails in the step instead.The guard is a no-op on GitHub-hosted runners, which is what lets it live in a shared workflow whose defaults stay hosted. It fails closed: unknown visibility stops the job.
Inputs
runnermacos-15release_runnerrunnermacos_runnerDefaults stay hosted. The fleet is opt-in per consumer and never inherited, so a public repo can't land on owned hardware by accident.
Self-hosted behaviour changes (automatic)
setup-xcodeis skipped — it re-points the machine's selected Xcode, which on a shared host reaches into every other repo's builds.xcodegenis expected preinstalled instead ofbrew installed per job, with a clear failure if missing..git/config— on a self-hosted host the disk outlives the job.Verification
actionlint: no new findings (the two reported are pre-existing inios-release.yml, confirmed against the base commit).pull_request_targetfork, public repo, unknown visibility, theallow-publicescape hatch, and two command-injection attempts via fork names containing$(...)and backticks. All pass; no injection artefacts created. Every value is passed through the environment, never interpolated.runs-onprecedence evaluated against GitHub's&&/||semantics across 10 cases, including every existing calling convention. Confirmed: a caller that passes nothing still resolves tomacos-15.shellcheckclean on the guard script; YAML parses on all four files.Note on
@v1The workflows reference
privacykey/gh-workflows/actions/assert-trusted-runner@v1, which resolves oncev1is moved onto this commit after merge. Retagv1.1.0and movev1as part of merging.🤖 Generated with Claude Code