Skip to content

Commit aee3e5a

Browse files
authored
fixexternal-plugins/cherrypicker): load bot repositories only if (#16)
skipFork is false
1 parent 5c303bb commit aee3e5a

File tree

1 file changed

+9
-6
lines changed
  • cmd/external-plugins/cherrypicker

1 file changed

+9
-6
lines changed

cmd/external-plugins/cherrypicker/main.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,6 @@ func main() {
123123
if err != nil {
124124
logrus.WithError(err).Fatal("Error getting bot name.")
125125
}
126-
repos, err := githubClient.GetRepos(botUser.Login, true)
127-
if err != nil {
128-
log.WithError(err).Fatal("Error listing bot repositories.")
129-
}
130126

131127
server := &Server{
132128
tokenGenerator: secret.GetTokenGenerator(o.webhookSecretFile),
@@ -142,11 +138,18 @@ func main() {
142138
allowAll: o.allowAll,
143139
issueOnConflict: o.issueOnConflict,
144140
labelPrefix: o.labelPrefix,
141+
skipFork: o.skipFork,
145142

146143
bare: &http.Client{},
147144
patchURL: "https://patch-diff.githubusercontent.com",
148-
149-
repos: repos,
145+
}
146+
if !server.skipFork {
147+
repos, err := githubClient.GetRepos(botUser.Login, true)
148+
if err != nil {
149+
log.WithError(err).Fatal("Error listing bot repositories.")
150+
} else {
151+
server.repos = repos
152+
}
150153
}
151154

152155
health := pjutil.NewHealthOnPort(o.instrumentationOptions.HealthPort)

0 commit comments

Comments
 (0)