diff --git a/.env.sample b/.env.sample index 3c6d7e64..5ded9527 100644 --- a/.env.sample +++ b/.env.sample @@ -2,7 +2,3 @@ INTEGRATION_ID= WEBHOOK_SECRET=development - -# Visit https://github.com/settings/tokens/new to create a new personal access -# token with `repo` scope. -GITHUB_TOKEN= diff --git a/script/console b/script/console index 9c24fdfa..cb379283 100755 --- a/script/console +++ b/script/console @@ -1,7 +1,17 @@ #!/usr/bin/env node +// Console for experimenting with GitHub API requests. +// +// Usage: GITHUB_TOKEN=xxx script/Console +// require('dotenv').config(); +if (!process.env.GITHUB_TOKEN) { + console.error('GITHUB_TOKEN environment variable must be set.'); + console.error('Create a personal access token at https://github.com/settings/tokens/new'); + process.exit(1); +} + const repl = require('repl').start('> '); const GitHubApi = require('github'); const github = new GitHubApi(); @@ -9,6 +19,6 @@ const github = new GitHubApi(); github.authenticate({ type: 'oauth', token: process.env.GITHUB_TOKEN -}); +}) repl.context.github = github;