-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDuplicateGithubRepos.py
More file actions
34 lines (22 loc) · 897 Bytes
/
Copy pathDuplicateGithubRepos.py
File metadata and controls
34 lines (22 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
"""
Duplicate repos specified in spreadsheet.
The Oauth key must have "repo" checked, or you'll get 404 error on user.create_repo().
Assumes an SSH key loaded for
git push --mirror
Example:
python DuplicateGithubRepos.py book.xlsx ~/.ssh/oauth orgname prefix
"""
from pathlib import Path
from argparse import ArgumentParser
import pandas
import gitbulk.duplicator as gu
p = ArgumentParser(description="Duplicate repos specified in spreadsheet")
p.add_argument("fn", help="spreadsheet filename")
p.add_argument("oauth", help="Oauth filename")
p.add_argument("username", help="username or organization to create duplicate under")
p.add_argument("stem", help="beginning of duplicated repo names")
P = p.parse_args()
fn = Path(P.fn).expanduser()
repos = pandas.read_excel(fn, index_col=0, header=0).squeeze()
gu.repo_dupe(repos, P.oauth, P.username, P.stem)