logger.Info().Msg(spec.AppAuth[0].Org)
for _, auth := range spec.AppAuth {
var (
itr *ghinstallation.Transport
err error
)
appId, err := strconv.ParseInt(auth.AppID, 10, 64)
if err != nil {
return nil, fmt.Errorf("failed to parse AppID %v: %w", auth.AppID, err)
}
installationId, err := strconv.ParseInt(auth.InstallationID, 10, 64)
if err != nil {
return nil, fmt.Errorf("failed to parse InstallationID %v: %w", auth.InstallationID, err)
}
if auth.PrivateKeyPath != "" {
itr, err = ghinstallation.NewKeyFromFile(http.DefaultTransport, appId, installationId, auth.PrivateKeyPath)
} else if auth.PrivateKey != "" {
itr, err = ghinstallation.New(http.DefaultTransport, appId, installationId, []byte(auth.PrivateKey))
}
if err != nil {
return nil, fmt.Errorf("failed to create GitHub client for org while reading private key %v: %w", auth.Org, err)
}
if spec.EnterpriseSettings != nil {
itr.BaseURL = spec.EnterpriseSettings.BaseURL
}
var ghc *github.Client
if auth.InstallationToken != "" {
httpClient := github.NewClient(nil).WithAuthToken(auth.InstallationToken)
ghc, err = githubClientForHTTPClient(httpClient.Client().Transport, logger, spec.EnterpriseSettings)
if err != nil {
return nil, fmt.Errorf("failed to create GitHub client for installation token: %w", err)
}
} else {
ghc, err = githubClientForHTTPClient(itr, logger, spec.EnterpriseSettings)
if err != nil {
return nil, fmt.Errorf("failed to create GitHub client for org in the final step %v: %w", auth.Org, err)
}
}
ghServices[auth.Org] = servicesForClient(ghc)
}
Hi @decent-viper,
Maybe raise an issue for this on GitHub with more details and the problem you’re trying to solve. It’ll be hard to debug this on Discord.
@herman Any idea how to add installationToken
?
I need it today to fix.
As far as I know, we don’t support using installation tokens for the GitHub plugin yet, but you can raise an issue. You can also open a PR and we can help you look into it there, but we won’t necessarily be able to do that today.