From 5a39382ec0c4218eda9544152f1ed11925834a2d Mon Sep 17 00:00:00 2001 From: davidvader Date: Wed, 18 Dec 2024 13:57:58 -0600 Subject: [PATCH] fix: skip app functionality when app isnt configured --- scm/github/repo.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scm/github/repo.go b/scm/github/repo.go index 0b04ccde4..d1648caa6 100644 --- a/scm/github/repo.go +++ b/scm/github/repo.go @@ -685,6 +685,11 @@ func (c *client) GetNetrcPassword(ctx context.Context, db database.Interface, r l.Tracef("getting netrc password for %s/%s", r.GetOrg(), r.GetName()) + // no GitHub App configured, use legacy oauth token + if c.AppsTransport == nil { + return u.GetToken(), nil + } + var err error // repos that the token has access to @@ -770,6 +775,11 @@ func (c *client) SyncRepoWithInstallation(ctx context.Context, r *api.Repo) (*ap "repo": r.GetName(), }).Tracef("syncing app installation for repo %s/%s", r.GetOrg(), r.GetName()) + // no GitHub App configured, skip + if c.AppsTransport == nil { + return r, nil + } + client, err := c.newGithubAppClient() if err != nil { return r, err