def register_runner()

in scripts/store-agent-creds.py [0:0]


def register_runner(dir: str, token: str, repo: str, runnergroup: Optional[str], store_as: str, index: int):
    os.chdir(dir)

    cmd = [
        "./config.sh",
        "--unattended",
        "--url",
        f"https://github.com/{repo}",
        "--token",
        token,
        "--name",
        f"Airflow Runner {index}",
    ]

    if runnergroup:
        cmd += ['--runnergroup', runnergroup]

    res = subprocess.call(cmd)

    if res != 0:
        exit(res)
    _put_runner_creds(store_as, index)