Form-to-Github Microservice
Receives requests from the Form Dispatcher and creates a GitHub issue via the GitHub API.
Params
Parameter | Description |
---|---|
repository |
The name of a repository you want to create an issue for (The repository must be under the City of Austin organization and the relevant machine user must be added as a collaborator on that repository.) |
title |
The title of the GitHub issue. |
description |
The user-submitted description |
meta |
Metadata collected on the client-side such as browser, OS, and device (Optional) |
Response
The app will return one of two JSON responses to the Form Dispatcher, which will then be returned to the browser. Failures and responses will each have a status
("success" or "error"), title
, and body
value. Successful responses will also include a url
parameter which will contain the URL for the newly-created issue.
Metadata collection
The original feature spec stipulated that browser/os/device data should be included in the form submission. This is handled via the meta
parameter, the value of which is appended to the bottom of the GitHub issue body.
GitHub Integration
The API uses a machine user to authenticate API requests. The first implementation uses the Innovation Engineering - City of Austin account.
To authenticate a new machine user:
- Create a new account on Github (this is your machine user)
- Create an Access Token (this will be how you make API requests as the machine user)
- Add the machine user as a collaborator on the repo(s) you want to create issues for with that machine user
- Add the token to your heroku 'GITHUB_FEEDBACK_TOKEN' env variable (in heroku -> settings -> reveal config vars)
Quickstart
Environment Variables
Store your desired machine user access token(s) as environment variables, and add them to the relevant array(s) in the token_for(repository)
method in submissions_controller.rb
.
Used in conjunction with the Form Dispatcher, the application runs locally on port 3003.
$ bundle install
$ rails s -p 3003
Environments
Production
URL: https://coa-test-form-github-issue.heroku.com/