When to use it.
- Your workflow already runs on GitHub’s Linux runners and only the iOS build or test needs a Mac
- You do not want an API key in your repository secrets, a GitHub App on your organization, or a self-hosted runner
Connect the repository
From a folder wherebox login is done:
OWNER can be your user or an organization, for example box ci connect acme/app. The repository is tied to the box account that connected it, and that account pays for its runs; set the step’s account input to that account’s login.
By default every ref of the repository may build, from the workflow file .github/workflows/box.yml. Narrow it with --ref and --workflow, each repeatable:
--monthly-usd. When the repository’s runs have spent that much in the last 30 days, the next run stops before it starts with ci_cap_reached and nothing is billed. Connecting again without the flag removes the cap.
box ci repos lists the connected repositories with their 30-day cap and last use. box ci disconnect OWNER/NAME stops them.
Add the step
From the root of the repository:.github/workflows/box.yml with the app folder, workspace, scheme and Xcode version it finds. Use --print to see it first, and --force to replace an existing file. The file looks like this:
permissions: id-token: write lets the job ask GitHub for the token. Without it the step stops with exit code 2.
What a run does
- Uploads only the files that changed since the repository’s last run. Dependency caches (SwiftPM, CocoaPods, DerivedData, node_modules) stay on the Mac for the repository.
- Waits for the Mac job and ends the step with its result, so the pull request check shows the iOS result. With
wait: falsethe step only submits the job and fails on purpose, so a submission is never read as a pass. - Shows the job’s Mac seconds and cost in the job summary. A new push cancels the previous run through
concurrency. - On a failed build, puts the first error line on the run as an annotation and uploads the logs and outputs as a workflow artifact.
- Runs a job once more when it fails on box’s side. A job that fails on box’s side is not charged.
Pull requests and TestFlight
A pull request run builds and tests on a simulator only. box refuses signing, TestFlight and secrets for it. Pull requests from forks get no OIDC token, so they cannot build on your account, andpull_request_target runs are refused.
To ship to TestFlight from a tag, add a job with command: ship that runs only for tags and waits for approval through a GitHub environment:
box ci check-signing tells you whether your account has what TestFlight needs (an App Store Connect key and a distribution certificate with its private key). It shows names and dates only, never a value, and exits with 2 when something is missing.
Inputs
Exit codes are the same as
box: see Exit codes.