From 3a5ef5158decabb3c0bc478b7502089d10a236cd Mon Sep 17 00:00:00 2001 From: Gary Moon Date: Fri, 30 Oct 2020 15:39:32 -0400 Subject: [PATCH] Add ability to skip archived repositories --- github_backup/github_backup.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/github_backup/github_backup.py b/github_backup/github_backup.py index 68bfb59..9f17110 100644 --- a/github_backup/github_backup.py +++ b/github_backup/github_backup.py @@ -278,6 +278,10 @@ def parse_args(): action='store_true', dest='include_starred_gists', help='include starred gists in backup [*]') + parser.add_argument('--skip-archived', + action='store_true', + dest='skip_archived', + help='skip project if it is archived') parser.add_argument('--skip-existing', action='store_true', dest='skip_existing', @@ -742,6 +746,8 @@ def filter_repositories(args, unfiltered_repositories): repositories = [r for r in repositories if r.get('language') and r.get('language').lower() in languages] # noqa if name_regex: repositories = [r for r in repositories if name_regex.match(r['name'])] + if args.skip_archived: + repositories = [r for r in repositories if not r.get('archived')] return repositories