This is an automated email from the ASF dual-hosted git repository.

fjy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 658fb2b  Fix bugs in milestone contributor script (#7545)
658fb2b is described below

commit 658fb2b0626d012b065779dcb02826d0ead0788d
Author: Jonathan Wei <[email protected]>
AuthorDate: Wed Apr 24 22:11:57 2019 -0700

    Fix bugs in milestone contributor script (#7545)
    
    * Only check PRs in milestone contributor script
    
    * Fix no-pagination bug
---
 docs/_bin/get-milestone-contributors.py | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/docs/_bin/get-milestone-contributors.py 
b/docs/_bin/get-milestone-contributors.py
index 54790b6..1ea62d5 100755
--- a/docs/_bin/get-milestone-contributors.py
+++ b/docs/_bin/get-milestone-contributors.py
@@ -36,18 +36,24 @@ contributors = set()
 # Get all users who created a closed issue or merged PR for a given milestone
 while not done:
   resp = 
requests.get("https://api.github.com/repos/apache/incubator-druid/issues?milestone=%s&state=closed&page=%s";
 % (milestone_num, page_counter))
-  pagination_link = resp.headers["Link"]
 
-  # last page doesn't have a "next"
-  if "rel=\"next\"" not in pagination_link:
-    done = True
+  if "Link" in resp.headers:
+    pagination_link = resp.headers["Link"]
+
+    # last page doesn't have a "next"
+    if "rel=\"next\"" not in pagination_link:
+      done = True
+    else:
+      page_counter += 1
   else:
-    page_counter += 1
+    # Not enough issues to require pagination
+    done = True
 
   issues = json.loads(resp.text)
   for issue in issues:
-    contributor_name = issue["user"]["login"]
-    contributors.add(contributor_name)
+    if "pull_request" in issue:
+      contributor_name = issue["user"]["login"]
+      contributors.add(contributor_name)
 
 # doesn't work as-is for python2, the contributor names are "unicode" instead 
of "str" in python2
 contributors = sorted(contributors, key=str.lower)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to