diff --git a/labelOpenPrs.js b/labelOpenPrs.js index 87df34ebe5..2346a8545a 100644 --- a/labelOpenPrs.js +++ b/labelOpenPrs.js @@ -42,7 +42,9 @@ const prPropsToGet = ['number', 'labels', 'user']; const guideFolderErrorsComment = guideFolderChecks(prFiles, username); if (guideFolderErrorsComment) { log.update(number, 'comment', guideFolderErrorsComment); - const result = await addComment(number, guideFolderErrorsComment); + if (process.env.PRODUCTION_RUN) { + const result = await addComment(number, guideFolderErrorsComment); + } await rateLimiter(process.env.RATELIMIT_INTERVAL | 1500); labelsToAdd['status: needs update'] = 1; } @@ -70,7 +72,9 @@ const prPropsToGet = ['number', 'labels', 'user']; const newLabels = Object.keys(labelsToAdd).filter(label => !existingLabels.includes(label)); if (newLabels.length) { log.update(number, 'labels', newLabels); - addLabels(number, newLabels, log); + if (process.env.PRODUCTION_RUN) { + addLabels(number, newLabels, log); + } await rateLimiter(process.env.RATELIMIT_INTERVAL | 1500); } else { diff --git a/prProcessingLog.js b/prProcessingLog.js index 85ca0d0fbe..493219e7f6 100644 --- a/prProcessingLog.js +++ b/prProcessingLog.js @@ -1,3 +1,4 @@ +const path = require('path'); const fs = require('fs'); const { saveToFile } = require('./fileFunctions'); @@ -8,7 +9,8 @@ class PrProcessingLog { this._lastPRlogged = null; this._finish = null; this._prs = {}; - this._logfile = 'data/open-prs-processed.json'; + //path.resolve(__dirname, '../../../guide'); + this._logfile = path.resolve(__dirname, './data/open-prs-processed.json'); } import() { diff --git a/sample.env b/sample.env index 3e1d5c94b1..3be9bc0946 100644 --- a/sample.env +++ b/sample.env @@ -1,4 +1,6 @@ USERNAME='camperbot' ACCESS_TOKEN='replace this with a personal access token' REPOSITORY_OWNER='freeCodeCamp-rocks' -REPOSITORY='freeCodeCamp' \ No newline at end of file +REPOSITORY='freeCodeCamp' +RATELIMIT_INTERVAL=1500 +PRODUCTION_RUN=false