This script launches a temporary self-hosted GitHub Actions runner inside a Docker container using summerwind/actions-runner-dind. It is useful for CI/CD workflows that require ephemeral, containerized runners for GitHub organizations.
- Bash
- Docker
- GitHub personal access token for registering runners
- The following CLI tools installed and in your
$PATH:
basename,realpath,date,echo,whoami,openssl,curl,jq
export SGCRUN_GITHUB_TOKEN="ghp_..."
/bin/bash sgcrun.sh my-org-name<github-organization>
Required. The GitHub organization where the runner will be registered.
Required:
SGCRUN_GITHUB_TOKEN
GitHub personal access token with permission to register runners for the organization.
Optional:
SGCRUN_LOG
Absolute or relative path to a writable log file. If set and the file exists, script output will be appended to it.
You may enable logging by creating a log file and exporting the SGCRUN_LOG environment variable:
touch /tmp/sgcrun.log
export SGCRUN_LOG="/tmp/sgcrun.log"
/bin/bash sgcrun.sh my-org-nameAll output, including errors, will be written to this file as well as shown in the terminal.
- Make sure Docker is running and you have permissions to run
dockercommands. - The script will exit early if required tools are not available.
- If the GitHub token is invalid or lacks permission, the registration will fail.
The container will be executed with the --privileged flag to support Docker-in-Docker (DinD) functionality. This grants the container extended permissions, which may pose a security risk if used in untrusted environments.
Use with caution.
MIT License © 2025