lita-pullrequests 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7fb70d9a92880f7968a8abd3630f910c92b5d9b
4
- data.tar.gz: 6aeb680bddfb78388f945b2f0a9a4225a5bf0386
3
+ metadata.gz: bf38c15c07dc898b239cec2885710ce57f6058db
4
+ data.tar.gz: e5eac46144f31a25048aebe81c41a3b34ee37a70
5
5
  SHA512:
6
- metadata.gz: b9ba3e4c7f7832e3e8fabe3cb80d0ff157404d1de47dea185f1441db80762bee4e3d59592f6f27f9d5665c7e01affbe927062ff38c8e7f6e982da91991a2b13d
7
- data.tar.gz: 92b0e722c461b6b6ff6930b29ef24a31c6e54d0662b0074241ec0fc6c04851258d9390a190f0922c6cc7b7a1b21f30a2c16ef865ba74f525f123ccaf4552b2ff
6
+ metadata.gz: b9a3d12b32a0b4264389a4e03ff4b5ff81cc444d12972b8ba8a7030553b3173b0252b5d5a0784b508932fc79edcf162a38b89b431bf6c89e0ae95245a44c8a6c
7
+ data.tar.gz: fe795650db0ba8249c355180bf7abf08108eeccafc6542d01c09ec33c1300919f13ebef483ab0c9c771a5eb386b6484ca8c098068f11b4eff3f1298d139679e2
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # lita-pullrequests
2
2
 
3
- A Lita handler to help you keep track of your pull requests. It can automatically post in your channels and tell you about which pull requests need attention in all of your repositories.
3
+ A Lita handler to help you **keep track of your pull requests**. It can automatically post in your channels on a schedule and tell you about pull requests that need attention in all of your repositories.
4
4
 
5
- This means that you can mark some pull requests as needing attention, and your Lita bot will automatically know about them and remind you to address them whenever you tell it to.
5
+ 1. Organize pull requests with labels on GitHub
6
+ 2. Lita will remind you about them later
6
7
 
7
8
  ## Installation
8
9
 
@@ -14,13 +15,24 @@ gem "lita-pullrequests"
14
15
 
15
16
  ## Configuration
16
17
 
18
+ Pull request summaries include three sections:
19
+
20
+ 1. Pull Requests that need a code review
21
+ 2. Pull Requests that are ready to be merged
22
+ 3. Pull Requests that need quality assurance
23
+
24
+ These are sorted based on GitHub labels attached to pull requests. You can configure your labels in your `lita_config`.
25
+
26
+ You will also need a personal access token for an account that has access to all of the repositories that are to be scraped. You can get one of these [here](https://github.com/settings/applications). You'll need to store the access token as an environment variable on Heroku or your server.
27
+
17
28
  Add the following configuration lines to your `lita_config`:
18
29
 
19
30
  ``` ruby
20
- config.handlers.pullrequests.access_token = "a-github-api-access-token"
31
+ config.handlers.pullrequests.access_token = ENV["GITHUB_ACCESS_TOKEN"]
21
32
  config.handlers.pullrequests.repos = ["username/reponame"]
22
- config.handlers.pullrequests.review_label = "title of a label that represents a pr ready for review"
23
- config.handlers.pullrequests.merge_label = "title of a label that represents a pr ready for merge"
33
+ config.handlers.pullrequests.review_label = "needs-review"
34
+ config.handlers.pullrequests.merge_label = "ready-for-merge"
35
+ config.handlers.pullrequests.qa_label = "qa-needed"
24
36
  ```
25
37
 
26
38
  ## Usage
@@ -7,6 +7,7 @@ module Lita
7
7
  config :repos, type: Array, required: true
8
8
  config :review_label, type: String, required: false
9
9
  config :merge_label, type: String, required: false
10
+ config :qa_label, type: String, required: false
10
11
 
11
12
  on :loaded, :remember_reminder
12
13
 
@@ -71,7 +72,7 @@ module Lita
71
72
  chat.reply "No pull requests need a review right now!"
72
73
  end
73
74
  else
74
- chat.reply("I'm not configured for a repo with that name.")
75
+ chat.reply "I'm not configured for a repo with that name."
75
76
  end
76
77
  end
77
78
 
@@ -93,21 +94,28 @@ module Lita
93
94
  end
94
95
  end
95
96
 
96
- def formatted_pull_request_summary
97
- response = ":heavy_exclamation_mark: *Pull Requests that need review*:\n"
98
-
99
- response += pulls_that_need_reviews.map do |pr|
100
- title, user = pr["title"], pr["user"]["login"]
101
- url = pr["pull_request"]["html_url"]
102
- "- _#{title}_ - #{user} \n #{url}"
103
- end.join("\n\n")
97
+ def pulls_that_need_qa
98
+ pulls = fetch_pull_requests
99
+ merge_label = config.qa_label || "QA Needed"
104
100
 
105
- response += "\n\n\n:white_check_mark: *Pull Requests that are ready for merging*:\n"
101
+ pulls.select do |pr|
102
+ pr["labels"] && pr["labels"].any? { |label| label["name"] == config.qa_label }
103
+ end
104
+ end
106
105
 
107
- response += pulls_that_need_merging.map do |pr|
108
- title, user = pr["title"], pr["user"]["login"]
109
- url = pr["pull_request"]["html_url"]
110
- "- _#{title}_ - #{user} \n #{url}"
106
+ def formatted_pull_request_summary
107
+ {
108
+ ":heavy_exclamation_mark: *Pull Requests that need review*:\n" => pulls_that_need_reviews,
109
+ ":thought_balloon: *Pull Requests that need QA*:\n" => pulls_that_need_qa,
110
+ ":white_check_mark: *Pull Requests that are ready for merging*:\n" => pulls_that_need_merging
111
+ }.map do |heading, pulls|
112
+ heading + if pulls.any?
113
+ pulls.map do |pr|
114
+ "- _#{pr['title']}_ - #{pr['user']['login']} \n #{pr['pull_request']['html_url']}"
115
+ end.join("\n\n")
116
+ else
117
+ "_None!_\n"
118
+ end
111
119
  end.join("\n\n")
112
120
  end
113
121
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-pullrequests"
3
- spec.version = "0.0.8"
3
+ spec.version = "0.0.9"
4
4
  spec.authors = ["Taylor Lapeyre"]
5
5
  spec.email = ["taylorlapeyre@gmail.com"]
6
6
  spec.description = %q{A Lita handler to help you keep track of your pull requests.}
@@ -6,6 +6,7 @@ describe Lita::Handlers::Pullrequests, lita_handler: true do
6
6
  Lita.config.handlers.pullrequests.repos = ["taylorlapeyre/lita-pullrequests"]
7
7
  Lita.config.handlers.pullrequests.review_label = "Needs Review"
8
8
  Lita.config.handlers.pullrequests.merge_label = "Ready To Merge"
9
+ Lita.config.handlers.pullrequests.qa_label = "QA Needed"
9
10
  end
10
11
 
11
12
  it { is_expected.to route_command("give me something to review for lita-pullrequests").to(:get_random_pr) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-pullrequests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Lapeyre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-04 00:00:00.000000000 Z
11
+ date: 2015-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita