* feat: show open boilerplate prs on dashboard fix: rest of boilerplate server changes fix: more fix: other * fix: update lib functions * fix: retrofitted one-off scripts * feat: added rateLimit for requests * fix: reduce time * fix: put limiter inside each route * fix: make client show when rated limited * fix: removed unused probot from app * fix: renamed folders * fix: consolidate config.js and constants.js * chore: update octokit to latest version * fix: remove invalid file * fix: refactored update-db.js * feat: add fcc logo * fix: logo url * fix: remove Home link * fix: change link colors * fix: added rate limiter to landing page * fix: ran npm install in client to create package-lock.json * fix: correct typo in doc Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> * fix: Replace favicon, Gitter => Discord Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> * fix: add extra linting guidance to package.json * Ignore contributor app Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> * fix: revert linting rules for client * fix: add skip_preflight_check=true for tests Co-authored-by: Kristofer Koishigawa <scissorsneedfoodtoo@gmail.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Kris Koishigawa <scissorsneedfoodtoo@gmail.com> Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com>
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
const {
 | 
						|
  github: { freeCodeCampRepo, defaultBase },
 | 
						|
  oneoff: { productionRun }
 | 
						|
} = require('../lib/config');
 | 
						|
 | 
						|
const { closeOpen } = require('../lib/pr-tasks');
 | 
						|
const { openJSONFile, ProcessingLog, rateLimiter } = require('../lib/utils');
 | 
						|
 | 
						|
const log = new ProcessingLog('prs-closed-reopened');
 | 
						|
 | 
						|
log.start();
 | 
						|
const getUserInput = async () => {
 | 
						|
  let filename = process.argv[2];
 | 
						|
 | 
						|
  if (!filename) {
 | 
						|
    throw 'Specify a file with PRs which needed to be closed and reopened.';
 | 
						|
  }
 | 
						|
 | 
						|
  let fileObj = openJSONFile(filename);
 | 
						|
  let { prs } = fileObj;
 | 
						|
  if (!prs.length) {
 | 
						|
    throw 'Either no PRs found in file or there or an error occurred.';
 | 
						|
  }
 | 
						|
  return { prs };
 | 
						|
};
 | 
						|
 | 
						|
(async () => {
 | 
						|
  const { prs } = await getUserInput(freeCodeCampRepo, defaultBase);
 | 
						|
  return prs;
 | 
						|
})()
 | 
						|
  .then(async prs => {
 | 
						|
    for (let { number, errorDesc } of prs) {
 | 
						|
      if (errorDesc !== 'unknown error') {
 | 
						|
        log.add(number, { number, closedOpened: true, errorDesc });
 | 
						|
        if (productionRun) {
 | 
						|
          await closeOpen(number);
 | 
						|
          await rateLimiter(90000);
 | 
						|
        }
 | 
						|
      } else {
 | 
						|
        log.add(number, { number, closedOpened: false, errorDesc });
 | 
						|
      }
 | 
						|
    }
 | 
						|
  })
 | 
						|
  .then(() => {
 | 
						|
    log.finish();
 | 
						|
    console.log('closing/reopening of PRs complete');
 | 
						|
  })
 | 
						|
  .catch(err => {
 | 
						|
    log.finish();
 | 
						|
    console.log(err);
 | 
						|
  });
 |