Skip to content

Setup Guide

GSD Planner edited this page May 26, 2026 · 1 revision

Setup Guide

This page covers prerequisites, runner registration, and running agent/poll_once.py locally for development.

Prerequisites

Requirement Notes
Python 3.12 Required by agent/poll_once.py (uses str | None union syntax from 3.10+)
GitHub CLI (gh) Required for runner registration and API operations
Git Required for repo operations
Windows (self-hosted runner) The production runner runs as a Windows service on MyLocalPC
GH_TOKEN or GITHUB_TOKEN Required by the agent to call the GitHub REST API

Environment Variables

Variable Required Description
GH_TOKEN Yes GitHub personal access token with repo and workflow scopes
GITHUB_TOKEN Alternative Injected automatically inside GitHub Actions jobs
GITHUB_REPOSITORY Optional Override target repo (default: Coding-Autopilot-System/ci-autopilot)
GITHUB_OWNER Optional Override org/owner (default: Coding-Autopilot-System)
GITHUB_REPO Optional Override repo name (default: ci-autopilot)

Running the Agent Locally

# Clone the repo
git clone https://github.com/Coding-Autopilot-System/ci-autopilot.git
cd ci-autopilot

# Set your token
export GH_TOKEN=<your_github_token>

# Run the agent (no pip install needed — stdlib only)
python -m agent.poll_once

The agent will print the count of queued issues and list the first 5 for review.

Self-Hosted Runner Registration (Windows)

Authenticate

cd C:\actions-runner
gh auth login -s repo,workflow,read:org,admin:org
gh auth status

Remove from Old Repo (if re-registering)

$removeToken = gh api -X POST repos/OgeonX-Ai/enterprise-ai-gateway/actions/runners/remove-token -q .token
.\config.cmd remove --token $removeToken

Register to ci-autopilot

$regToken = gh api -X POST repos/Coding-Autopilot-System/ci-autopilot/actions/runners/registration-token -q .token
.\config.cmd --unattended `
  --url https://github.com/Coding-Autopilot-System/ci-autopilot `
  --token $regToken `
  --name MyLocalPC `
  --runasservice `
  --replace

Start the Runner Service

$serviceName = Get-Content .\.service
Start-Service -Name $serviceName
Get-Service -Name $serviceName

Validate Runner Is Online

gh api repos/Coding-Autopilot-System/ci-autopilot/actions/runners -q '.runners[] | {name, status, online}'

Expected output: {"name":"MyLocalPC","status":"online","online":true}

Notes

  • Registration and removal tokens are short-lived. Always fetch fresh tokens immediately before use.
  • Use -X POST with gh api for all runner token endpoints.
  • The agent uses requests fallback to gh CLI if GITHUB_TOKEN/GH_TOKEN is unavailable.
  • For full security posture and token rotation guidance see the Configuration Reference wiki page.

Related Documentation