Problem Child
Allows authenticated or anonymous users to fill out a standard web form to create GitHub issues.
How it works
- You create a standard HTML form, defining what fields you'd like a given authenticated or anonymous user to fill out
- They go to a hosted URL and fill out the form
- The fields are converted to markdown bullets and inserted into the body of a new issue created against the GitHub repo you specify
Usage
- Create a
Gemfileand addgem "problem_child" - Create a
config.rufile and add the following:ruby require "problem_child" run ProblemChild::App - Follow the configuration options below
Requirements
You'll need to have Memcache running.
On OS X, run brew install memcached to install, followed by memcached to run the memcache server.
On Heroku you'll want to run heroku addons:add memcachier:dev to add a free Memecache instance to your app.
Configuring
You must set the following as environmental variables:
GITHUB_CLIENT_IDandGITHUB_CLIENT_SECRET- Created via github.com/settings/applications/newGITHUB_REPO- the repo to open the issue against in the form ofowner/repo
You must also set one of the following:
GITHUB_TOKEN- A personal access token for a bot account with the ability to create an issue in theGITHUB_REPOif you would like all submissions to be anonymousGITHUB_ORG_ID- The GitHub Org ID e.g,@whitehouseif you'd like all users to authenticate against a GitHub Org prior to being presented the formGITHUB_TEAM_ID- The numeric Team ID (e.g., 1234) if you'd like all users to authenticate against a GitHub Team prior to being presented the form
Pro-tip: When developing locally, you can add these values to a .env file in the project root, and they will be automatically read in on load
Customizing
By default, Problem Child will prompt the user with a simple form that contains only the title and body. If you'd like to customize the form, you must do the following:
- Create a new folder called
views - Create a
layout.erbandform.erb - Customize both the layout and form as a standard HTML form. Check out these examples to get started.
- Add the following (middle) line to your
config.rufile:
require "problem_child"
ProblemChild.views_dir = "/path/to/your/views/directory"
run ProblemChild::App
Pro-tip: You can use any standard HTML form fields, but be sure to name one field title, which will become the issue title.
Pro-tip II: Problem child can set labels. You can do this either as a hidden field:
<input type="hidden" name="labels[]" value="bug" />
or as a checkbox:
<input type="checkbox" name="labels[]" value="bug" />
<input type="checkbox" name="labels[]" value="suggestion" />
Contributing
- Fork it ( https://github.com/[my-github-username]/problem_child/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request