Skip to content

Instantly share code, notes, and snippets.

@db0company
Created March 7, 2016 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save db0company/af073004ade6a70da10b to your computer and use it in GitHub Desktop.
Save db0company/af073004ade6a70da10b to your computer and use it in GitHub Desktop.
Script to duplicate milestones from a repo to another one on GitHub easily
# Get agithub.py from https://github.com/jpaugh/agithub
from agithub import Github
username = 'yourusername'
password = 'yourpassword'
from_owner = username # Can be an organization
from_repo = 'yourrepo'
to_owners = [username, username] # Can be organizations
to_repos = ['yourotherrepo', 'andanotherrepo']
g = Github(yourusername, yourpassword)
status, milestones = g.repos[from_owner][from_repo].milestones.get()
for (to_owner, to_repo) in zip(to_owners, to_repos):
for m in milestones:
g.repos[to_owner][to_repo].milestones.post(body={'title': m['title'], 'description': m['description'], 'due_on': m['due_on'] })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment