Introduce support for looking up GH app installation ID

Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
This commit is contained in:
Matheus Pimenta 2026-01-19 10:15:53 +00:00
parent c125bcb1ca
commit d57313ae2c
No known key found for this signature in database
GPG key ID: 4639F038AE28FBFF
10 changed files with 129 additions and 151 deletions

View file

@ -77,10 +77,11 @@ type Options struct {
Address string
// GitHub App options
GitHubAppID string
GitHubAppInstallationID string
GitHubAppPrivateKey string
GitHubAppBaseURL string
GitHubAppID string
GitHubAppInstallationOwner string
GitHubAppInstallationID string
GitHubAppPrivateKey string
GitHubAppBaseURL string
}
type VerificationCrt struct {

View file

@ -235,13 +235,22 @@ func GenerateNotation(options Options) (*manifestgen.Manifest, error) {
}
func GenerateGitHubApp(options Options) (*manifestgen.Manifest, error) {
var opts []secrets.GitHubAppOption
if owner := options.GitHubAppInstallationOwner; owner != "" {
opts = append(opts, secrets.WithGitHubAppInstallationOwner(owner))
}
if id := options.GitHubAppInstallationID; id != "" {
opts = append(opts, secrets.WithGitHubAppInstallationID(id))
}
if u := options.GitHubAppBaseURL; u != "" {
opts = append(opts, secrets.WithGitHubAppBaseURL(u))
}
secret, err := secrets.MakeGitHubAppSecret(
options.Name,
options.Namespace,
options.GitHubAppID,
options.GitHubAppInstallationID,
options.GitHubAppPrivateKey,
options.GitHubAppBaseURL,
opts...,
)
if err != nil {
return nil, err