From 26e00904eaf74c8af34ac5b14a620a69576ed967 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Fri, 6 Nov 2020 13:51:25 -0500 Subject: [PATCH] add some error handling around common issues (#16387) --- script/graphql/update-files.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/script/graphql/update-files.js b/script/graphql/update-files.js index 0496cf90f65f..ed51b443b5a0 100755 --- a/script/graphql/update-files.js +++ b/script/graphql/update-files.js @@ -15,6 +15,20 @@ const processUpcomingChanges = require('./utils/process-upcoming-changes') const processSchemas = require('./utils/process-schemas') const prerenderObjects = require('./utils/prerender-objects') +// check for required PAT +if (!process.env.GITHUB_TOKEN) { + console.error('Error! You must have a GITHUB_TOKEN set in an .env file to run this script.') + process.exit(1) +} + +// check for required Ruby gems (see note below about why this is needed) +try { + execSync('gem which graphql') +} catch (err) { + console.error('\nYou need to run: bundle install') + process.exit(1) +} + // TODO this step is only required as long as we support GHE versions *OLDER THAN* 2.21 // as soon as 2.20 is deprecated on 2021-02-11, we can remove all graphql-ruby filtering const removeHiddenMembersScript = path.join(__dirname, './utils/remove-hidden-schema-members.rb')