Coder Social home page Coder Social logo

close_old_pull_requests's Introduction

EveryPolitician

Data about every national legislature in the world, freely available for you to use

Repo summary

These are some of the key repos in the EveryPolitician family. There are others.

The repos for many of our scrapers are kept separately in github.com/everypolitician-scrapers.

Technical blog

The EveryPolitician bot's own page is a good jumping-off point to lots of semi-technical explanations of what's going on (it has its own blog on Medium). For example:

The bot is on twitter as @everypolitician

Contributing

If you have data for us, or know where to get it, please read our page about how to contribute.

Team

EveryPolitician is a mySociety project.

close_old_pull_requests's People

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

close_old_pull_requests's Issues

More useful output

At the moment the output of this command is:

Pull request 16560 is outdated. (Newest pull request is 16748)
Pull request 16592 is outdated. (Newest pull request is 16738)
Pull request 16678 is outdated. (Newest pull request is 16721)

It would be more useful it it actually said what action had been taken for each pull request.

Make the bot username explicit

At the moment we're assuming that the GitHub access token belongs to the bot, then we're using github.user.login to get the name of the bot's GitHub account. I think it would be less confusing to just hardcode the bot's GitHub login (but perhaps make it overridable). Without this we end up with confusing messages like this one.

Finder should return the full pull request

Problem

I want to add the url for the pull request to the message that I print out for #7, but currently the Finder class only returns a PullRequest struct with the number of the pull request (and a superseded_by number if there's a newer pull request).

Proposed solution

The Finder#outdated method should return the pull request objects that Octokit returns so that the url and other properties can be accessed for logging purposes. This might be easiest done as a hash so we can do something like the following:

finder.outdated do |outdated_pull_request, new_pull_request|
  # …
end

Acceptance criteria

At this point in Cleaner#clean_old_pull_requests I should be able to access the Octokit pull request instance for the outdated and the new pull requests.

Only run against pull requests from the bot

Problem

We're currently running this library against all pull requests, but actually we should only be running them against pull requests from the bot. Otherwise we end up in a situation like everypolitician/everypolitician-data#25100 and everypolitician/everypolitician-data#25102 where two human generated pull requests have the same title and then you get a confusing message from the bot.

Proposed solution

Only run against pull requests from the bot.

Handle commits with no author information

Problem

We're seeing errors like this in the Travis build:

rake aborted!
NoMethodError: undefined method `[]' for nil:NilClass
/home/travis/build/everypolitician/everypolitician-data/vendor/bundle/ruby/2.3.0/bundler/gems/close_old_pull_requests-ba2dc4ebe77e/lib/close_old_pull_requests.rb:45:in `block in author_logins'
/home/travis/build/everypolitician/everypolitician-data/vendor/bundle/ruby/2.3.0/bundler/gems/close_old_pull_requests-ba2dc4ebe77e/lib/close_old_pull_requests.rb:45:in `map'
/home/travis/build/everypolitician/everypolitician-data/vendor/bundle/ruby/2.3.0/bundler/gems/close_old_pull_requests-ba2dc4ebe77e/lib/close_old_pull_requests.rb:45:in `author_logins'
/home/travis/build/everypolitician/everypolitician-data/vendor/bundle/ruby/2.3.0/bundler/gems/close_old_pull_requests-ba2dc4ebe77e/lib/close_old_pull_requests.rb:53:in `empty?'
/home/travis/build/everypolitician/everypolitician-data/vendor/bundle/ruby/2.3.0/bundler/gems/close_old_pull_requests-ba2dc4ebe77e/lib/close_old_pull_requests.rb:72:in `block in clean_old_pull_requests'
/home/travis/build/everypolitician/everypolitician-data/vendor/bundle/ruby/2.3.0/bundler/gems/close_old_pull_requests-ba2dc4ebe77e/lib/close_old_pull_requests.rb:67:in `each'
/home/travis/build/everypolitician/everypolitician-data/vendor/bundle/ruby/2.3.0/bundler/gems/close_old_pull_requests-ba2dc4ebe77e/lib/close_old_pull_requests.rb:67:in `clean_old_pull_requests'
/home/travis/build/everypolitician/everypolitician-data/vendor/bundle/ruby/2.3.0/bundler/gems/close_old_pull_requests-ba2dc4ebe77e/lib/close_old_pull_requests.rb:12:in `clean'
/home/travis/build/everypolitician/everypolitician-data/Rakefile.rb:45:in `block in <top (required)>'
/home/travis/build/everypolitician/everypolitician-data/vendor/bundle/ruby/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'

Looks like this was because it had encountered a commit which had no author key attached to it because the email used for the commit wasn't associated with a GitHub account.

# Proposed solution

We should check for a commit with a null author and handle that case correctly.

Notes for reproducing

To reproduce this error you'll need to create a commit using an email address that isn't associated with a GitHub account.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.