{"action":"created","issue":{"url":"https://api.github.com/repos/danger/danger/issues/615","repository_url":"https://api.github.com/repos/danger/danger","labels_url":"https://api.github.com/repos/danger/danger/issues/615/labels{/name}","comments_url":"https://api.github.com/repos/danger/danger/issues/615/comments","events_url":"https://api.github.com/repos/danger/danger/issues/615/events","html_url":"https://github.com/danger/danger/pull/615","id":181355753,"number":615,"title":"Introducing `danger pr` command","user":{"login":"JuanitoFatas","id":1000669,"avatar_url":"https://avatars.githubusercontent.com/u/1000669?v=3","gravatar_id":"","url":"https://api.github.com/users/JuanitoFatas","html_url":"https://github.com/JuanitoFatas","followers_url":"https://api.github.com/users/JuanitoFatas/followers","following_url":"https://api.github.com/users/JuanitoFatas/following{/other_user}","gists_url":"https://api.github.com/users/JuanitoFatas/gists{/gist_id}","starred_url":"https://api.github.com/users/JuanitoFatas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuanitoFatas/subscriptions","organizations_url":"https://api.github.com/users/JuanitoFatas/orgs","repos_url":"https://api.github.com/users/JuanitoFatas/repos","events_url":"https://api.github.com/users/JuanitoFatas/events{/privacy}","received_events_url":"https://api.github.com/users/JuanitoFatas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-10-06T08:43:50Z","updated_at":"2016-10-06T09:55:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/danger/danger/pulls/615","html_url":"https://github.com/danger/danger/pull/615","diff_url":"https://github.com/danger/danger/pull/615.diff","patch_url":"https://github.com/danger/danger/pull/615.patch"},"body":"This Pull Requests adds a `danger pr` command that works for open & closed PR. So that in the future we can rebuild `danger local` to make it only work for local git repositories.\r\n\r\nCan try it out if you clone this branch and:\r\n\r\n```\r\n# open pr\r\n$ bin/danger pr --use-pr=615\r\n\r\n# merged pr\r\n$ bin/danger pr --use-pr=612 \r\n```\r\n\r\n--\r\n\r\n<details>\r\n<summary>Implementation details</summary>\r\nThe implementation of `danger pr` command is copied from `danger local` command, under the hood is passed in [another environment variable: `ENV[\"CHECK_OPEN_PR\"]`](https://github.com/danger/danger/blob/058ed0211b8ed02576e5ffdbd46afaf73c29b8c9/lib/danger/commands/pr.rb#L61), [which is if you passed this option `--use-pr`](https://github.com/danger/danger/blob/058ed0211b8ed02576e5ffdbd46afaf73c29b8c9/lib/danger/commands/pr.rb#L21-L23). When receive this env, `LocalGitRepo` (`danger pr` and `danger local` all use `EnvironmentManager`, which then use `LocalGitRepo`) will check for open PRs, and this way we can keep current `danger local` behavior remains unchanged.\r\n</details>\r\n\r\n<details>\r\n<summary>Regarding to Rubocop:</summary>\r\n\r\nThese 2 rules I don't agree.\r\n\r\n```\r\nOffenses:\r\n\r\nlib/danger/ci_source/support/pull_request_finder.rb:84:11: C: Align select with begin on line 82.\r\n          select { |pr| pr.state == \"open\" }.\r\n          ^^^^^^\r\nlib/danger/ci_source/support/pull_request_finder.rb:85:11: C: Align map with begin on line 82.\r\n          map do |open_pr|\r\n          ^^^\r\n```\r\n\r\nNow\r\n\r\n```ruby\r\n@open_pull_requests ||= begin\r\n  client.pull_requests(repo_slug).\r\n    select { |pr| pr.state == \"open\" }.\r\n    map do |open_pr|\r\n      OpenPullRequest.new(\r\n        open_pr.number.to_s,\r\n        open_pr.title,\r\n        open_pr.head.sha,\r\n        open_pr.base.sha\r\n      )\r\n    end\r\nend\r\n```\r\nRubocop\r\n\r\n```ruby\r\n@open_pull_requests ||= begin\r\n  client.pull_requests(repo_slug).\r\n                        select { |pr| pr.state == \"open\" }.\r\n                        map do |open_pr|\r\n                          OpenPullRequest.new(\r\n                            open_pr.number.to_s,\r\n                            open_pr.title,\r\n                            open_pr.head.sha,\r\n                            open_pr.base.sha\r\n                          )\r\n                        end\r\nend\r\n```\r\n\r\nWhat do you prefer? I can stick to what Rubocop wants if everyone feels rubocop's better.\r\n\r\n=> Changed to new style in 419732c.\r\n</details>"},"comment":{"url":"https://api.github.com/repos/danger/danger/issues/comments/251917636","html_url":"https://github.com/danger/danger/pull/615#issuecomment-251917636","issue_url":"https://api.github.com/repos/danger/danger/issues/615","id":251917636,"user":{"login":"JuanitoFatas","id":1000669,"avatar_url":"https://avatars.githubusercontent.com/u/1000669?v=3","gravatar_id":"","url":"https://api.github.com/users/JuanitoFatas","html_url":"https://github.com/JuanitoFatas","followers_url":"https://api.github.com/users/JuanitoFatas/followers","following_url":"https://api.github.com/users/JuanitoFatas/following{/other_user}","gists_url":"https://api.github.com/users/JuanitoFatas/gists{/gist_id}","starred_url":"https://api.github.com/users/JuanitoFatas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuanitoFatas/subscriptions","organizations_url":"https://api.github.com/users/JuanitoFatas/orgs","repos_url":"https://api.github.com/users/JuanitoFatas/repos","events_url":"https://api.github.com/users/JuanitoFatas/events{/privacy}","received_events_url":"https://api.github.com/users/JuanitoFatas/received_events","type":"User","site_admin":false},"created_at":"2016-10-06T09:55:25Z","updated_at":"2016-10-06T09:55:25Z","body":"> Only failed on Circle, wonder if Circle did something weird.\r\n\r\nCircle mutated our remote url 😱 I made the Regexp more robust to also handle it in 35c0783 <3"}}
{"actor":{"display_login":"JuanitoFatas"}}