Files
probot/bin/probot-run.js
Brandon Keepers f6946a0607 Probot Support for GitHub App Manifests (#650)
* Add button to setup GitHub app

* Add app.yml

* Add some comments to app.yml

* Associate events with permissions

* Allow configuring app with manifest

* Hacky version of callback URL for configuring app

* Remove manifest stuff for now

* Return nil if private key is not found

* Move setup stuff to a separate plugin

* Revert changes to default plugin

* Remove FIXME

* Revert changes to default template

* Use separate template for setup

* Fix lint warnings

* Convert test helper to typescript

* Initial test for setup app

* Require tests files to match `.test.(js|ts)`

* Account for multiple protocols in x-forwarded-proto

* Wrap pem in quotes

* Collapse class into request method for now

* run `refresh` after updating .env on Glitch

* Extract update-dotenv to a node module

* Create a smee url if one does not exist

* Hacky version of serving up the manifest

* WIP Manifest with code

* add comments for plan + figure out port

* using user-agent header for review lab

* add success view to redirect to after installation

* api is actually on github

* start making post

* fix quoting issue on POST

* everything is off review lab and on dotcom

* working version of app manifest flow

* Start trying to write tests against setup

* more refactor into thingerator; basic tests; write plans for other tests

* merge better..

* ok atom conflict handling broke

* hack the tests back together

* pass the tests 👊🏼

* moar test

* make it open in a new tab for Wil 💖

* make boolean work

* clean up logic, move messgae, just return html url not response

* clean up tests 👷🏾‍♀️

* rename Brandon's thingerator to manifest-creation
2018-09-26 15:22:11 -04:00

45 lines
1.4 KiB
JavaScript
Executable File

#!/usr/bin/env node
require('dotenv').config()
const pkgConf = require('pkg-conf')
const program = require('commander')
const {findPrivateKey} = require('../lib/private-key')
program
.usage('[options] <apps...>')
.option('-p, --port <n>', 'Port to start the server on', process.env.PORT || 3000)
.option('-W, --webhook-proxy <url>', 'URL of the webhook proxy service.`', process.env.WEBHOOK_PROXY_URL)
.option('-w, --webhook-path <path>', 'URL path which receives webhooks. Ex: `/webhook`', process.env.WEBHOOK_PATH)
.option('-a, --app <id>', 'ID of the GitHub App', process.env.APP_ID)
.option('-s, --secret <secret>', 'Webhook secret of the GitHub App', process.env.WEBHOOK_SECRET)
.option('-P, --private-key <file>', 'Path to certificate of the GitHub App', findPrivateKey)
.parse(process.argv)
program.privateKey = findPrivateKey()
const {createProbot} = require('../')
const probot = createProbot({
id: program.app,
secret: program.secret,
cert: program.privateKey,
port: program.port,
webhookPath: program.webhookPath,
webhookProxy: program.webhookProxy
})
const setupMode = !program.app || !program.privateKey
if (setupMode) {
const setupApp = require('../lib/apps/setup')
probot.load(setupApp)
probot.start()
} else {
pkgConf('probot').then(pkg => {
probot.setup(program.args.concat(pkg.apps || pkg.plugins || []))
probot.start()
})
}