Skip to content

Commit

Permalink
fix: skip version check if user is offline (#2498)
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge authored Jul 6, 2024
1 parent fef048f commit 2016b7a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ func Execute() {
func checkUpgrade(ctx context.Context, fsys afero.Fs) (string, error) {
if shouldFetchRelease(fsys) {
version, err := utils.GetLatestRelease(ctx)
if exists, _ := afero.DirExists(fsys, utils.SupabaseDirPath); exists && len(version) > 0 {
if exists, _ := afero.DirExists(fsys, utils.SupabaseDirPath); exists {
// If user is offline, write an empty file to skip subsequent checks
err = utils.WriteFile(utils.CliVersionPath, []byte(version), fsys)
}
return version, err
Expand Down
3 changes: 1 addition & 2 deletions internal/utils/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ var (
func GetGtihubClient(ctx context.Context) *github.Client {
githubOnce.Do(func() {
var client *http.Client
token := os.Getenv("GITHUB_TOKEN")
if len(token) > 0 {
if token := os.Getenv("GITHUB_TOKEN"); len(token) > 0 {
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: token},
)
Expand Down

0 comments on commit 2016b7a

Please sign in to comment.