Skip to content

Commit 5adce69

Browse files
committed
Ensure GitHub token is set
1 parent f343d8b commit 5adce69

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pkg/kepctl/commands/query.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ func runQuery(opts *repo.QueryOpts) error {
110110
if err != nil {
111111
return errors.Wrap(err, "creating repo client")
112112
}
113+
rc.TokenPath = rootOpts.TokenPath
113114

114115
return rc.Query(opts)
115116
}

pkg/repo/query.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,11 @@ func (r *Repo) Query(opts *QueryOpts) error {
110110
fmt.Fprintf(r.Out, "Searching for KEPs...\n")
111111
}
112112

113-
if tokenErr := r.SetGitHubToken(r.TokenPath); tokenErr != nil {
114-
return errors.Wrapf(tokenErr, "setting GitHub token")
113+
if r.TokenPath != "" {
114+
logrus.Infof("Setting GitHub token: %v", r.TokenPath)
115+
if tokenErr := r.SetGitHubToken(r.TokenPath); tokenErr != nil {
116+
return errors.Wrapf(tokenErr, "setting GitHub token")
117+
}
115118
}
116119

117120
allKEPs := make([]*api.Proposal, 0, 10)

0 commit comments

Comments
 (0)