-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
duplicate: generalize to multiple repos per team
- Loading branch information
Showing
5 changed files
with
47 additions
and
56 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,34 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
""" | ||
Duplicate repos specified in spreadsheet. | ||
Requires GitHub Oauth login. | ||
The Oauth file should be in a secure place, NOT in a Git repo! | ||
Maybe encrypted and with permissions 600. | ||
The Oauth key must have "repo" checked, or you'll get 404 error on user.create_repo(). | ||
Assumes you have an SSH key loaded for git push --mirror step | ||
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 | ||
import gitbulk as gb | ||
|
||
|
||
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("-u", "--username", help="username or organization to create duplicate under") | ||
p.add_argument("-s", "--stem", help="beginning of duplicated repo names") | ||
p.add_argument("-w", "--sheet", help="excel sheet to process", required=True) | ||
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() | ||
|
||
repos = gb.read_repos(P.fn, P.sheet) | ||
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) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
|
||
from argparse import ArgumentParser | ||
|
||
import gitbulk.base as gb | ||
import gitbulk as gb | ||
|
||
|
||
def main(): | ||
|
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 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 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