Created
December 6, 2019 16:53
-
-
Save nakomis/d4181f756b3908064ccfb49ff3130feb to your computer and use it in GitHub Desktop.
Copies PRs merged since a date to the clipboard. Format is comma-separated #, URL, Title
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is just a modified version of @sjcorbett's script at https://gist.github.com/sjcorbett/72ed944b06ce3a138fbe516e8d36f624 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from datetime import date | |
from github import Github | |
import clipboard | |
# Date of last release. | |
not_before = date(2018, 9, 12) | |
# See https://github.com/settings/tokens | |
user = "..." | |
token = "..." | |
g = Github(user, token) | |
def merged_since(since=not_before): | |
r = g.get_repo("apache/brooklyn") | |
for pr in r.get_pulls(state="closed"): | |
if pr.merged and (pr.merged_at.date() >= since): | |
yield pr | |
output = "" | |
with open('/tmp/output', 'w') as f: | |
for pr in merged_since(not_before): | |
t = pr.title | |
num = "%d" % pr.number | |
print "Adding " + num + " " + pr.title | |
output = output + num + "," + pr.html_url + "," + pr.title.encode('ascii', 'ignore').replace(",", " ") + ",\n" | |
clipboard.copy(output) | |
print "Done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Version must be > 1.29 if using Python 2 (i.e. one that has https://github.com/PyGithub/PyGithub/pull/495) | |
# 1.29 is the latest release as of 2016-12-01. | |
PyGithub > 1.29 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment