Introduce support for looking up GH app installation ID
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user