config: Fix Netlify default cache dir logic
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 29 Jun 2021 07:51:09 +0000 (09:51 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 29 Jun 2021 07:51:09 +0000 (09:51 +0200)
Fixes #8710

helpers/path.go

index fd35fafc9cbe1488bccdf9b2c60723516800eec4..6d4827bd2bb6bcb5449ec4a39d999d7e5dc4e616 100644 (file)
@@ -412,8 +412,8 @@ func getCacheDir(cfg config.Provider) string {
                return addTrailingFileSeparator(cacheDir)
        }
 
-       // Both of these are fairly distinctive OS env keys used by Netlify.
-       if os.Getenv("DEPLOY_PRIME_URL") != "" && os.Getenv("PULL_REQUEST") != "" {
+       // This is always set to true when running on Netlify.
+       if os.Getenv("NETLIFY") == "true" {
                // Netlify's cache behaviour is not documented, the currently best example
                // is this project:
                // https://github.com/philhawksworth/content-shards/blob/master/gulpfile.js