golang-github-enterprise-runners

command module
v0.0.0-...-0526cf0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

README

golang-github-enterprise-runners

So, you want to automatically register GitHub Actions Self Hosted Runners for your Orginizatiton. You've probably looked at the docs and thought "why did they make it so difficult?" Well, here's a fully working proof-of-concept using Go that will generate the various tokens and use them to call the APIs needed to (finally) get a Runner registration token.

!!! NOTE !!!

This code logs secret values and should NOT be used in a production environment! It is provided as a proof-of-concept so you can see the various steps needed to get a registration token. Also, the error handling and whole structure needs work before it's used for production workloads.

Prerequisites

  1. You've created a GitHub application and given it Read & Write permissions for Organization > Self-hosted runners.
  2. You've installed the app to the orginization for which you want to manage runners.
  3. You've generated a private key for the app and have a copy of the file.
  4. You've noted the App ID and its Installation ID.

Now you can update the const values in the main.go file and run it to get your runner registration tokens.

go run main.go

You can then use the token generated to register a new Runner.

./config.sh --url https://my.github-enterprise.com/MyOrg --token TOKEN

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL