Guest User

Untitled

a guest
Aug 20th, 2018
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import datetime
  2. from github import Github
  3. import getpass
  4.  
  5. username = raw_input("Github User:")
  6. pw = getpass.getpass("Github Password:")
  7. g = Github(username, pw)
  8. org = g.get_organization("") # Set your organisation here
  9. repo = org.get_repo("") # Set the repo you want to use here
  10.  
  11. milestones = repo.get_milestones(direction="desc")
  12. for ms in milestones:
  13. td = (ms.due_on - datetime.datetime.now()).days
  14. if td > 0 and td < 8:
  15. break
  16.  
  17. print "Setting issues to next milestone: {}".format(ms.due_on)
  18. issues = [x for x in repo.get_issues(state="open", milestone="*")]
  19. for issue in issues:
  20. if issue.milestone != ms:
  21. print "Set {}'s issue {} to next milestone".format(issue.assignee.name, issue.id)
  22. issue.edit(milestone=ms)
Add Comment
Please, Sign In to add comment