cloudbase / garm

GitHub Actions Runner Manager
Apache License 2.0
136 stars 26 forks source link

Add GitHub App support #228

Closed gabriel-samfira closed 8 months ago

gabriel-samfira commented 8 months ago

This change adds the ability to use GitHub Apps to authenticate against the GitHub API. This gives us a larger quota for API requests (15k vs 5k for PATs).

Also, each GitHub App has its own quota, whereas PATs share the same user quota.

To use it, define a new credentials config section with the following contents:

[[github]]
  # This is an arbitrary name
  name = "github_app"
  description = "github app with access to example org/repo"
  # This can be "pat" or "app". Based on this, the HTTP client will either be instantiated
  # using a PAT or an app installation.
  auth_type = "app"
  [github.app]
    # You get this after creating the app. This needs to be changed
    app_id = 1
    private_key_path = "/etc/garm/yourAppName.2024-03-01.private-key.pem"
    # This is the installation ID in your org or repo. This needs to be changed.
    installation_id = 99

Fixes: #214

gabriel-samfira commented 8 months ago

@Hdom give it a try if you have the time.