peppa/scripts/ci-runner-register.sh
Асель 3ab408eb70 PEP-57: CI for factory projects — act_runner, template workflow, connect CI
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:19:11 +05:00

16 lines
902 B
Bash
Executable File

#!/usr/bin/env bash
# Регистрирует act_runner Пеппы на репозитории peppa-bot (уровень пользователя) или на
# один репозиторий: scripts/ci-runner-register.sh [owner/repo]
# Токен регистрации берётся токеном peppa-bot из .env и в вывод не попадает.
set -euo pipefail
cd "$(dirname "$0")/.."
set -a; . "${PEPPA_ENV_FILE:-./.env}"; set +a
if [[ $# -ge 1 ]]; then
path="repos/$1/actions/runners/registration-token"; name="repo-${1//\//--}"
else
path="user/actions/runners/registration-token"; name="peppa-bot"
fi
PEPPA_RUNNER_TOKEN=$(curl -fsS -H "Authorization: token $GITEA_TOKEN" "$GITEA_URL/api/v1/$path" | python3 -c 'import json,sys;print(json.load(sys.stdin)["token"])')
export PEPPA_RUNNER_TOKEN
docker exec -e PEPPA_RUNNER_TOKEN peppa-act-runner peppa-runner-register "$name"