Docs / Guides
On this page
Monorepos and per-repo caps
A monorepo can queue dozens of jobs per push. On a shared account that can take every vCPU and leave other repositories waiting. Kajiya's per-repository caps keep that in check, and GitHub's path filters and concurrency groups keep the job count down.
Cap the repository#
Set a Max vCPU for the monorepo under Repositories in the dashboard, or with the API:
curl -X PATCH "https://kajiya.app/api/v1/repos/3" \
-H "Authorization: Bearer $KAJIYA_API_KEY" -H "Content-Type: application/json" \
-d '{"max_vcpu": 16}'With an account limit of 32 vCPUs and a cap of 16 on the monorepo, at least 16 vCPUs stay available for everything else. Jobs over the cap wait with reason repo_limit and start as the monorepo's own jobs finish. Keep the cap at least as large as the biggest job in the repository, or that job never starts.
To hold a repository entirely, for example during an incident, pause it: {"paused": true}. Running jobs finish; new ones wait until you resume.
Run only what changed#
Skip workflows when their part of the tree did not change:
on:
pull_request:
paths:
- "services/api/**"
- "packages/shared/**"Or decide per job with a paths filter step and if: conditions, so one workflow can test only the packages a change touches.
Cancel superseded runs#
When a branch gets a new push, the previous run of the same workflow is usually useless. A concurrency group cancels it:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: trueJobs of the cancelled run that had not reached a machine yet are released and not billed when the repository is connected through the GitHub App or a repository webhook. Jobs that were already running are billed for the minutes they ran.
Size each job#
Put each job on the smallest label that does not slow it down: lint and small checks on kajiya-2, builds and big test suites on kajiya-4 or kajiya-8. Usage by label shows where the vCPU-hours go:
curl -s "https://kajiya.app/api/v1/usage?group_by=label&since=2026-12-01" -H "Authorization: Bearer $KAJIYA_API_KEY" | jq '.rows'See the cost per repository#
GET /api/v1/repos returns cost_30d_usd and jobs_30d for every repository, and GET /api/v1/usage?group_by=repo covers any period up to 400 days.