Only panic during build in CI
Luke Karrys committed
Oct 20, 2023 at 14:48 UTC
71016649c0dd9af7a0e9398e3e877ae583163534
1 file changed
+3
-3
gatsby-node.js
+3
-3
@@ -3,7 +3,7 @@ const {Octokit: CoreOctokit} = require('@octokit/rest')
3
const {throttling} = require('@octokit/plugin-throttling')
4
const {retry} = require('@octokit/plugin-retry')
5
6
-const PROD = process.env.NODE_ENV === 'production'
6
+const CI = !!process.env.CI
7
const REPO_URL = 'https://github.com/npm/documentation'
8
const NWO = new URL(REPO_URL).pathname.slice(1)
9
const REPO_BRANCH = 'main'
@@ -244,7 +244,7 @@ const fetchContributors = async (path, fm, {reporter, octokit}) => {
244
const noAuth = (await octokit.auth()).type === 'unauthenticated'
245
if (noAuth) {
246
const msg = `Cannot fetch contributors without GitHub authentication.`
247
- if (PROD) {
247
+ if (CI) {
248
reporter.panic(msg)
249
return
250
}
@@ -288,7 +288,7 @@ const fetchContributors = async (path, fm, {reporter, octokit}) => {
288
latestCommit,
289
}
290
} catch (err) {
291
- reporter[PROD ? 'panic' : 'error'](`Error fetching contributors for ${path}`, err)
291
+ reporter[CI ? 'panic' : 'error'](`Error fetching contributors for ${path}`, err)
292
return
293
}
294
}