Generate a summary-of-changes comment on EveryPolitician data pull requests
Ruby HTML Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib/everypolitician
test
.gitignore
.rubocop.yml
.rubocop_todo.yml
.travis.yml
Gemfile
LICENSE.txt
README.md
Rakefile
comment_template.md.erb
everypolitician-pull_request.gemspec

README.md

EveryPolitician Pull Request summary

This is the code the EveryPolitician bot uses to inspect data pull requests (specifically those on the everypolitician-data repo) and add helpful summaries to them. The bot writes the summary as a comment on the Pull Request (for example like this or this). The summary helps the human who then decides whether or not to merge the data.

Read a full description at the bot's blog: "I'm a bot who comments".

Installation

Add this line to your application's Gemfile:

gem 'everypolitician-pull_request'

And then execute:

$ bundle

Or install it yourself as:

$ gem install everypolitician-pull_request

Usage

To print a summary of an everypolitician-data pull request as markdown, use the following:

require 'everypolitician/pull_request'
puts Everypolitician::PullRequest::Summary.new(16984).as_markdown

Where 16984 is the pull request number in everypolitician-data that you want the review for.

Integration with rake

To add the rake tasks put the following in your Rakefile:

require 'everypolitician/pull_request/rake_task'
Everypolitician::PullRequest::RakeTask.new.install_tasks

Then you can run the following tasks:

bundle exec rake pull_request_summary:print
bundle exec rake pull_request_summary:comment
bundle exec rake pull_request_summary:travis

For a description of these tasks run:

bundle exec rake -T

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Deployment

everypolitician-data uses the travis version of this. An updated version can be deployed by running bundle update everypolitician-pull_request in that repo.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/everypolitician/everypolitician-pull_request.

License

The gem is available as open source under the terms of the MIT License.