in reference-api/sources/github/github.go [73:86]
func GetInstallationToken(jwtToken string, repo string) (string, error) {
client := github.NewClient(nil).WithAuthToken(jwtToken)
owner, repoName, _ := strings.Cut(repo, "/")
ctx := context.Background()
installation, _, err := client.Apps.FindRepositoryInstallation(ctx, owner, repoName)
if err != nil {
return "", err
}
token, _, err := client.Apps.CreateInstallationToken(ctx, *installation.ID, nil)
if err != nil {
return "", err
}
return *token.Token, nil
}