githubapp
A small Go package for handling authentication with a Github App using owner login and repository names instead of UUIDs. Installations and repositories are
cached internally and refreshed (lazily) on a set interval, to reduce the number of List*
API calls against the Apps API.
Usage
package main
import (
"github.com/telia-oss/githubapp"
"github.com/google/go-github/v45/github"
)
func main() {
client, err := githubapp.NewClient(911, []byte("private-key"))
if err != nil {
panic(err)
}
app := githubapp.New(client)
token, err := app.CreateInstallationToken(
"telia-oss",
[]string{"githubapp"},
&githubapp.Permissions{
Metadata: github.String("read"),
},
)
if err != nil {
panic(err)
}
}