{"id":37201656,"url":"https://github.com/kyhau/github-runner-utils","last_synced_at":"2026-01-14T23:15:24.173Z","repository":{"id":37098285,"uuid":"461670410","full_name":"kyhau/github-runner-utils","owner":"kyhau","description":"github-runner-utils returns the GitHub runner registration token for registering a self-hosted runner to GitHub","archived":false,"fork":false,"pushed_at":"2026-01-11T21:00:56.000Z","size":201,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-12T00:52:54.410Z","etag":null,"topics":["github-runner","github-selfhosted","go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kyhau.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-02-21T01:51:18.000Z","updated_at":"2026-01-11T21:00:59.000Z","dependencies_parsed_at":"2024-02-11T23:25:38.739Z","dependency_job_id":"e88f7e3b-a5ca-4f3c-87e4-3fa0efafa413","html_url":"https://github.com/kyhau/github-runner-utils","commit_stats":{"total_commits":64,"total_committers":3,"mean_commits":"21.333333333333332","dds":0.125,"last_synced_commit":"8f9ac5f8b7e6b5a9a649f599411219e1ec9555fe"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kyhau/github-runner-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyhau%2Fgithub-runner-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyhau%2Fgithub-runner-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyhau%2Fgithub-runner-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyhau%2Fgithub-runner-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kyhau","download_url":"https://codeload.github.com/kyhau/github-runner-utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyhau%2Fgithub-runner-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28437947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-runner","github-selfhosted","go"],"created_at":"2026-01-14T23:15:21.818Z","updated_at":"2026-01-14T23:15:23.610Z","avatar_url":"https://github.com/kyhau.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# github-runner-utils\n\n[![githubactions](https://github.com/kyhau/github-runner-utils/workflows/github-runner-utils-build/badge.svg)](https://github.com/kyhau/github-runner-utils/actions)\n\n`github-runner-utils` returns the GitHub runner registration token for registering a self-hosted runner to GitHub.\n\n## Usage\n\n```\nUsage of ./github-runner-utils:\n  -appId string\n        GitHub App ID\n  -awsRegion string\n        AWS Region (same as that of IAM Role) (default \"ap-southeast-2\")\n  -iamRoleArn string\n        ARN of IAM Role with secret read permission\n  -installId string\n        GitHub Install ID\n  -orgName string\n        GitHub Org Name\n  -secretArn string\n        ARN of GitHub Runner Secret\n  -version\n        Show version of this app\n```\n\n## What does github-runner-utils do?\n\n1. First retrieve the PEM stored in SSM Parameter Store and convert it to **JWT** for a Bearer Token which can be used to retreive the runner installation token in the Authorization header.\n\n2. Then call GitHub API to get the App token, which is set on the GitHub app. Command line looks like:\n    ```\n    APP_TOKEN=$(curl --location --request POST \"https://api.github.com/app/installations/${GH_APP_ID}/access_tokens\" \\\n      --header \"Authorization: Bearer ${JWT_TOKEN}\" \\\n      --header 'Accept: application/vnd.github.v3+json' | jq -r '.token')\n    ```\n\n3. Then call GitHub API to get the runner registration token, which is a short lived token for (only) adding the runners. Command line looks like:\n    ```\n    REGO_TOKEN=$(curl --location --request POST 'https://api.github.com/orgs/${GH_ORG_NAME}/actions/runners/registration-token' \\\n      --header \"Authorization: token ${APP_TOKEN}\" \\\n      --header 'Accept: application/vnd.github.machine-man-preview+json' | jq -r '.token')\n    ```\n\nThe runner registration token is needed to complete the runner installation.\n\nFor example, in your UserData,\n```\ncd /opt/github/actions-runner\n./config.sh --url https://github.com/${GH_ORG_NAME} --token $REGO_TOKEN\n./svc.sh install\n./svc.sh start\n```\n\n## Build Binary\n\nTested with `go version 1.20 linux/amd64`\n\n```\n## Install and output binary\n$ go build\n\n## Run binary\n$ ./github-runner-utils \\\n  -appId ${GH_APP_ID} \\\n  -installId \"${GH_APP_ID}\" \\\n  -orgName \"${GH_ORG_NAME}\" \\\n  -secretArn ${SECRET_MANAGER_SECRET_ARN_OF_GITHUB_PEM} \\\n  -iamRoleArn ${IAM_ROLE_ARN_ALLOW_READ_SECRET} \\\n  -awsRegion \"ap-southeast-2\"\n```\n\nOptionally override the `Version` string in source.\n```\n$ go build -v -ldflags=\"-X 'main.Version=v1.0.0'\"\n```\n\n## Local Build and Run\n\n```\n## Update module: Output: go.mod being updated, go.sum being created/updated\n$ go get -u ./... \u0026\u0026 go mod tidy\n\n## Build and saves the compiled package in the local build cache. Output: ./github-runner-utils\n$ go build\n\n## Run locally\n$ go run github-runner-utils.go \\\n  -appId ${GH_APP_ID} \\\n  -installId \"${GH_APP_ID}\" \\\n  -orgName \"${GH_ORG_NAME}\" \\\n  -secretArn ${SECRET_MANAGER_SECRET_ARN_OF_GITHUB_PEM} \\\n  -iamRoleArn ${IAM_ROLE_ARN_ALLOW_READ_SECRET} \\\n  -awsRegion \"ap-southeast-2\"\n```\n\n## Run unit tests\n```\n$ go test -v\n\n# With coverage\n$ go test -v -coverprofile=coverage.out\n```\n\n## Development Notes\n\n1. Ensure your go.sum file is committed along with your go.mod file.\n2. Standard \"log\" module does not have log level.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyhau%2Fgithub-runner-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyhau%2Fgithub-runner-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyhau%2Fgithub-runner-utils/lists"}