diff --git a/package.json b/package.json index 9ca0e34..1ee7f9a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "disco", "description": "deploy and manage your web projects", - "version": "0.5.33", + "version": "0.5.34", "author": "The disco Team", "bin": { "disco": "./bin/run.js" diff --git a/src/commands/github/apps/add.ts b/src/commands/github/apps/add.ts index ed8a5b3..fc0dd56 100644 --- a/src/commands/github/apps/add.ts +++ b/src/commands/github/apps/add.ts @@ -2,6 +2,7 @@ import {Command, Flags} from '@oclif/core' import {getDisco} from '../../../config.js' import {request} from '../../../auth-request.js' import open from 'open' +import input from '@inquirer/input' export default class GithubAppsAdd extends Command { static description = 'add a Github app' @@ -23,6 +24,27 @@ export default class GithubAppsAdd extends Command { const url = `https://${discoConfig.host}/api/github-apps/create` const res = await request({method: 'POST', url, discoConfig, body, expectedStatuses: [201]}) const respBody = (await res.json()) as any + + // thanks @robsimmons for this excellent suggestion! + this.log('') + this.log("I'm about to open a browser that is going to create a GitHub Application.") + this.log('This app will be named: Disco (some-random-name)') + this.log('') + this.log( + "You'll be able to control which repositories disco has access to through this app. When you 'git push' changes to an authorized repo, disco will automatically trigger a deployment.", + ) + + this.log('') + const response = await input({message: 'Is it okay to open a browser? y/n', default: 'y'}) + if (response === 'n') { + this.log('') + this.log('You need to copy and paste this URL into a browser to finish setup:') + this.log('') + this.log(respBody.pendingApp.url) + return + } + + this.log('') this.log('Opening the URL to install the app:') this.log('') this.log(respBody.pendingApp.url)