Skip to content

Commit 3f67364

Browse files
committed
better messaging and prompt on github apps add
1 parent 35de37e commit 3f67364

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "disco",
33
"description": "deploy and manage your web projects",
4-
"version": "0.5.33",
4+
"version": "0.5.34",
55
"author": "The disco Team",
66
"bin": {
77
"disco": "./bin/run.js"

src/commands/github/apps/add.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {Command, Flags} from '@oclif/core'
22
import {getDisco} from '../../../config.js'
33
import {request} from '../../../auth-request.js'
44
import open from 'open'
5+
import input from '@inquirer/input'
56

67
export default class GithubAppsAdd extends Command {
78
static description = 'add a Github app'
@@ -23,6 +24,27 @@ export default class GithubAppsAdd extends Command {
2324
const url = `https://${discoConfig.host}/api/github-apps/create`
2425
const res = await request({method: 'POST', url, discoConfig, body, expectedStatuses: [201]})
2526
const respBody = (await res.json()) as any
27+
28+
// thanks @robsimmons for this excellent suggestion!
29+
this.log('')
30+
this.log("I'm about to open a browser that is going to create a GitHub Application.")
31+
this.log('This app will be named: Disco (some-random-name)')
32+
this.log('')
33+
this.log(
34+
"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.",
35+
)
36+
37+
this.log('')
38+
const response = await input({message: 'Is it okay to open a browser? y/n', default: 'y'})
39+
if (response === 'n') {
40+
this.log('')
41+
this.log('You need to copy and paste this URL into a browser to finish setup:')
42+
this.log('')
43+
this.log(respBody.pendingApp.url)
44+
return
45+
}
46+
47+
this.log('')
2648
this.log('Opening the URL to install the app:')
2749
this.log('')
2850
this.log(respBody.pendingApp.url)

0 commit comments

Comments
 (0)