nested-runner
Self-hosted раннеры GitHub Actions, которые сами крутятся внутри GitHub Actions (ubuntu-latest). Матрёшка.
Зачем: доказать, что так можно. Кто потащит в прод — тот лох.
Как это работает
Заводит в целевом репо эфемерный runner scale set и слушает его очередь. Пришёл job — контроллер забирает его и диспатчит runner.yml у себя. Тот поднимает внутри ubuntu-latest, регистрирует его в scale set целевого репо по JIT-конфигу, отрабатывает один job и умирает. Больше NESTED_MAX раннеров одновременно не бывает. docker compose down сносит scale set, раннеров и висящие запуски.
Что нажать
1. Создать токен
Аккаунт должен быть админом целевого репозитория и коллабаратором этого.
Settings → Developer settings → Personal access tokens → Tokens (classic) → Generate new token (classic).
Имя nested, no expiration, скоупы repo и workflow.
2. Положить compose-файл
mkdir -p /opt/nested-runner && nano /opt/nested-runner/compose.yml:
services:
nested-runner:
image: ghcr.io/wprhvso/nested-runner:latest
container_name: nested-runner
restart: unless-stopped
stop_grace_period: 2m
command: ["owner/target"]
environment:
GH_TOKEN: ${GH_TOKEN:?нужен токен в .env}
# GH_REPO: wprhvso/nested-runner
# NESTED_SCALE_SET: nested
# NESTED_MAX: 20
# NESTED_WORKFLOW: runner.yml
# NESTED_DEBUG: 1
Токен — рядом, в /opt/nested-runner/.env:
GH_TOKEN=ghp_...
chmod 600 /opt/nested-runner/.env
Целевых репозиториев можно перечислить сразу несколько: command: ["owner/a", "owner/b"].
3. Запустить
env -C /opt/nested-runner docker compose up -d
Логи:
env -C /opt/nested-runner docker compose logs -f
Снести:
env -C /opt/nested-runner docker compose down
4. Поправить runs-on во всех нужных workflow
runs-on: nested
Использовать массивы в runs-on нельзя.
5. Проверить запуском своего workflow
Обновление
env -C /opt/nested-runner docker compose pull && env -C /opt/nested-runner docker compose up -d
Команды
| Команда | Что делает |
|---|---|
just build |
собрать образ локально |
just run <repo> |
собрать и запустить, переменные подставит сам |
just version [vX.Y.Z] |
показать или проставить версию |
just tag |
тег vX.Y.Z и пуш |
just test |
тестовый workflow |
just qa |
yamllint, actionlint, ruff, basedpyright |
just keys |
сгенерировать пару ключей, уже сделано |
Metadata
Release files for nested-runner 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nested_runner-0.2.0.tar.gz | 17.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nested_runner-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.8 kB
Release files / nested_runner-0.2.0.tar.gz
| Download URL | nested_runner-0.2.0.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31e36247a57b21ce89cda88fc9dd456bb50247d0a4b36bb28f14ed6f8500283d
|
|
BLAKE2b-256 checksum How to use checksums |
f6d125e8ae26b936faedff32056c3035977026442efca4b6204611fcaf84a9a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 9, 2026.
Transparency logRelease files / nested_runner-0.2.0-py3-none-any.whl
| Download URL | nested_runner-0.2.0-py3-none-any.whl |
|---|---|
| Size | 22.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f24239e2137e5c52b6e806e0a11334c9a7c41695d6b567102c85aeedc167bdaf
|
|
BLAKE2b-256 checksum How to use checksums |
2c9ca95823812cdc8b13f10d4135ea6c63242ec609b66fc44ecb6628181518cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 9, 2026.
Transparency log