github-backup 0.60.0__tar.gz → 0.61.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {github_backup-0.60.0 → github_backup-0.61.0}/CHANGES.rst +8 -1
  2. {github_backup-0.60.0/github_backup.egg-info → github_backup-0.61.0}/PKG-INFO +8 -6
  3. {github_backup-0.60.0 → github_backup-0.61.0}/README +7 -5
  4. {github_backup-0.60.0 → github_backup-0.61.0}/README.rst +7 -5
  5. github_backup-0.61.0/github_backup/__init__.py +1 -0
  6. {github_backup-0.60.0 → github_backup-0.61.0}/github_backup/github_backup.py +44 -0
  7. {github_backup-0.60.0 → github_backup-0.61.0/github_backup.egg-info}/PKG-INFO +8 -6
  8. {github_backup-0.60.0 → github_backup-0.61.0}/tests/test_all_starred.py +1 -0
  9. github_backup-0.60.0/github_backup/__init__.py +0 -1
  10. {github_backup-0.60.0 → github_backup-0.61.0}/LICENSE.txt +0 -0
  11. {github_backup-0.60.0 → github_backup-0.61.0}/MANIFEST.in +0 -0
  12. {github_backup-0.60.0 → github_backup-0.61.0}/github_backup/__main__.py +0 -0
  13. {github_backup-0.60.0 → github_backup-0.61.0}/github_backup/cli.py +0 -0
  14. {github_backup-0.60.0 → github_backup-0.61.0}/github_backup.egg-info/SOURCES.txt +0 -0
  15. {github_backup-0.60.0 → github_backup-0.61.0}/github_backup.egg-info/dependency_links.txt +0 -0
  16. {github_backup-0.60.0 → github_backup-0.61.0}/github_backup.egg-info/entry_points.txt +0 -0
  17. {github_backup-0.60.0 → github_backup-0.61.0}/github_backup.egg-info/top_level.txt +0 -0
  18. {github_backup-0.60.0 → github_backup-0.61.0}/github_backup.egg-info/zip-safe +0 -0
  19. {github_backup-0.60.0 → github_backup-0.61.0}/release-requirements.txt +0 -0
  20. {github_backup-0.60.0 → github_backup-0.61.0}/requirements.txt +0 -0
  21. {github_backup-0.60.0 → github_backup-0.61.0}/setup.cfg +0 -0
  22. {github_backup-0.60.0 → github_backup-0.61.0}/setup.py +0 -0
  23. {github_backup-0.60.0 → github_backup-0.61.0}/tests/test_attachments.py +0 -0
  24. {github_backup-0.60.0 → github_backup-0.61.0}/tests/test_case_sensitivity.py +0 -0
  25. {github_backup-0.60.0 → github_backup-0.61.0}/tests/test_http_451.py +0 -0
  26. {github_backup-0.60.0 → github_backup-0.61.0}/tests/test_json_dump_if_changed.py +0 -0
  27. {github_backup-0.60.0 → github_backup-0.61.0}/tests/test_pagination.py +0 -0
  28. {github_backup-0.60.0 → github_backup-0.61.0}/tests/test_retrieve_data.py +0 -0
  29. {github_backup-0.60.0 → github_backup-0.61.0}/tests/test_skip_assets_on.py +0 -0
  30. {github_backup-0.60.0 → github_backup-0.61.0}/tests/test_starred_skip_size_over.py +0 -0
@@ -1,9 +1,16 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- 0.60.0 (2025-12-24)
4
+ 0.61.0 (2026-01-12)
5
5
  -------------------
6
6
  ------------------------
7
+ - Docs: Add missing `--retries` argument to README. [Lukas Bestle]
8
+ - Test: Adapt tests to new argument. [Lukas Bestle]
9
+ - Feat: Backup of repository security advisories. [Lukas Bestle]
10
+
11
+
12
+ 0.60.0 (2025-12-24)
13
+ -------------------
7
14
  - Rm max_retries.py. [michaelmartinez]
8
15
  - Readme. [michaelmartinez]
9
16
  - Don't use a global variable, pass the args instead. [michaelmartinez]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: github-backup
3
- Version: 0.60.0
3
+ Version: 0.61.0
4
4
  Summary: backup a github user or organization
5
5
  Home-page: http://github.com/josegonzalez/python-github-backup
6
6
  Author: Jose Diaz-Gonzalez
@@ -73,9 +73,9 @@ CLI Help output::
73
73
  [--watched] [--followers] [--following] [--all]
74
74
  [--issues] [--issue-comments] [--issue-events] [--pulls]
75
75
  [--pull-comments] [--pull-commits] [--pull-details]
76
- [--labels] [--hooks] [--milestones] [--repositories]
77
- [--bare] [--no-prune] [--lfs] [--wikis] [--gists]
78
- [--starred-gists] [--skip-archived] [--skip-existing]
76
+ [--labels] [--hooks] [--milestones] [--security-advisories]
77
+ [--repositories] [--bare] [--no-prune] [--lfs] [--wikis]
78
+ [--gists] [--starred-gists] [--skip-archived] [--skip-existing]
79
79
  [-L [LANGUAGES ...]] [-N NAME_REGEX] [-H GITHUB_HOST]
80
80
  [-O] [-R REPOSITORY] [-P] [-F] [--prefer-ssh] [-v]
81
81
  [--keychain-name OSX_KEYCHAIN_ITEM_NAME]
@@ -85,7 +85,7 @@ CLI Help output::
85
85
  [--skip-assets-on [SKIP_ASSETS_ON ...]] [--attachments]
86
86
  [--throttle-limit THROTTLE_LIMIT]
87
87
  [--throttle-pause THROTTLE_PAUSE]
88
- [--exclude [EXCLUDE ...]]
88
+ [--exclude [EXCLUDE ...]] [--retries MAX_RETRIES]
89
89
  USER
90
90
 
91
91
  Backup a github account
@@ -131,6 +131,8 @@ CLI Help output::
131
131
  --hooks include hooks in backup (works only when
132
132
  authenticated)
133
133
  --milestones include milestones in backup
134
+ --security-advisories
135
+ include security advisories in backup
134
136
  --repositories include repository clone in backup
135
137
  --bare clone bare repositories
136
138
  --no-prune disable prune option for git fetch
@@ -431,7 +433,7 @@ Quietly and incrementally backup useful Github user data (public and private rep
431
433
  export FINE_ACCESS_TOKEN=SOME-GITHUB-TOKEN
432
434
  GH_USER=YOUR-GITHUB-USER
433
435
 
434
- github-backup -f $FINE_ACCESS_TOKEN --prefer-ssh -o ~/github-backup/ -l error -P -i --all-starred --starred --watched --followers --following --issues --issue-comments --issue-events --pulls --pull-comments --pull-commits --labels --milestones --repositories --wikis --releases --assets --attachments --pull-details --gists --starred-gists $GH_USER
436
+ github-backup -f $FINE_ACCESS_TOKEN --prefer-ssh -o ~/github-backup/ -l error -P -i --all-starred --starred --watched --followers --following --issues --issue-comments --issue-events --pulls --pull-comments --pull-commits --labels --milestones --security-advisories --repositories --wikis --releases --assets --attachments --pull-details --gists --starred-gists $GH_USER
435
437
 
436
438
  Debug an error/block or incomplete backup into a temporary directory. Omit "incremental" to fill a previous incomplete backup. ::
437
439
 
@@ -43,9 +43,9 @@ CLI Help output::
43
43
  [--watched] [--followers] [--following] [--all]
44
44
  [--issues] [--issue-comments] [--issue-events] [--pulls]
45
45
  [--pull-comments] [--pull-commits] [--pull-details]
46
- [--labels] [--hooks] [--milestones] [--repositories]
47
- [--bare] [--no-prune] [--lfs] [--wikis] [--gists]
48
- [--starred-gists] [--skip-archived] [--skip-existing]
46
+ [--labels] [--hooks] [--milestones] [--security-advisories]
47
+ [--repositories] [--bare] [--no-prune] [--lfs] [--wikis]
48
+ [--gists] [--starred-gists] [--skip-archived] [--skip-existing]
49
49
  [-L [LANGUAGES ...]] [-N NAME_REGEX] [-H GITHUB_HOST]
50
50
  [-O] [-R REPOSITORY] [-P] [-F] [--prefer-ssh] [-v]
51
51
  [--keychain-name OSX_KEYCHAIN_ITEM_NAME]
@@ -55,7 +55,7 @@ CLI Help output::
55
55
  [--skip-assets-on [SKIP_ASSETS_ON ...]] [--attachments]
56
56
  [--throttle-limit THROTTLE_LIMIT]
57
57
  [--throttle-pause THROTTLE_PAUSE]
58
- [--exclude [EXCLUDE ...]]
58
+ [--exclude [EXCLUDE ...]] [--retries MAX_RETRIES]
59
59
  USER
60
60
 
61
61
  Backup a github account
@@ -101,6 +101,8 @@ CLI Help output::
101
101
  --hooks include hooks in backup (works only when
102
102
  authenticated)
103
103
  --milestones include milestones in backup
104
+ --security-advisories
105
+ include security advisories in backup
104
106
  --repositories include repository clone in backup
105
107
  --bare clone bare repositories
106
108
  --no-prune disable prune option for git fetch
@@ -401,7 +403,7 @@ Quietly and incrementally backup useful Github user data (public and private rep
401
403
  export FINE_ACCESS_TOKEN=SOME-GITHUB-TOKEN
402
404
  GH_USER=YOUR-GITHUB-USER
403
405
 
404
- github-backup -f $FINE_ACCESS_TOKEN --prefer-ssh -o ~/github-backup/ -l error -P -i --all-starred --starred --watched --followers --following --issues --issue-comments --issue-events --pulls --pull-comments --pull-commits --labels --milestones --repositories --wikis --releases --assets --attachments --pull-details --gists --starred-gists $GH_USER
406
+ github-backup -f $FINE_ACCESS_TOKEN --prefer-ssh -o ~/github-backup/ -l error -P -i --all-starred --starred --watched --followers --following --issues --issue-comments --issue-events --pulls --pull-comments --pull-commits --labels --milestones --security-advisories --repositories --wikis --releases --assets --attachments --pull-details --gists --starred-gists $GH_USER
405
407
 
406
408
  Debug an error/block or incomplete backup into a temporary directory. Omit "incremental" to fill a previous incomplete backup. ::
407
409
 
@@ -43,9 +43,9 @@ CLI Help output::
43
43
  [--watched] [--followers] [--following] [--all]
44
44
  [--issues] [--issue-comments] [--issue-events] [--pulls]
45
45
  [--pull-comments] [--pull-commits] [--pull-details]
46
- [--labels] [--hooks] [--milestones] [--repositories]
47
- [--bare] [--no-prune] [--lfs] [--wikis] [--gists]
48
- [--starred-gists] [--skip-archived] [--skip-existing]
46
+ [--labels] [--hooks] [--milestones] [--security-advisories]
47
+ [--repositories] [--bare] [--no-prune] [--lfs] [--wikis]
48
+ [--gists] [--starred-gists] [--skip-archived] [--skip-existing]
49
49
  [-L [LANGUAGES ...]] [-N NAME_REGEX] [-H GITHUB_HOST]
50
50
  [-O] [-R REPOSITORY] [-P] [-F] [--prefer-ssh] [-v]
51
51
  [--keychain-name OSX_KEYCHAIN_ITEM_NAME]
@@ -55,7 +55,7 @@ CLI Help output::
55
55
  [--skip-assets-on [SKIP_ASSETS_ON ...]] [--attachments]
56
56
  [--throttle-limit THROTTLE_LIMIT]
57
57
  [--throttle-pause THROTTLE_PAUSE]
58
- [--exclude [EXCLUDE ...]]
58
+ [--exclude [EXCLUDE ...]] [--retries MAX_RETRIES]
59
59
  USER
60
60
 
61
61
  Backup a github account
@@ -101,6 +101,8 @@ CLI Help output::
101
101
  --hooks include hooks in backup (works only when
102
102
  authenticated)
103
103
  --milestones include milestones in backup
104
+ --security-advisories
105
+ include security advisories in backup
104
106
  --repositories include repository clone in backup
105
107
  --bare clone bare repositories
106
108
  --no-prune disable prune option for git fetch
@@ -401,7 +403,7 @@ Quietly and incrementally backup useful Github user data (public and private rep
401
403
  export FINE_ACCESS_TOKEN=SOME-GITHUB-TOKEN
402
404
  GH_USER=YOUR-GITHUB-USER
403
405
 
404
- github-backup -f $FINE_ACCESS_TOKEN --prefer-ssh -o ~/github-backup/ -l error -P -i --all-starred --starred --watched --followers --following --issues --issue-comments --issue-events --pulls --pull-comments --pull-commits --labels --milestones --repositories --wikis --releases --assets --attachments --pull-details --gists --starred-gists $GH_USER
406
+ github-backup -f $FINE_ACCESS_TOKEN --prefer-ssh -o ~/github-backup/ -l error -P -i --all-starred --starred --watched --followers --following --issues --issue-comments --issue-events --pulls --pull-comments --pull-commits --labels --milestones --security-advisories --repositories --wikis --releases --assets --attachments --pull-details --gists --starred-gists $GH_USER
405
407
 
406
408
  Debug an error/block or incomplete backup into a temporary directory. Omit "incremental" to fill a previous incomplete backup. ::
407
409
 
@@ -0,0 +1 @@
1
+ __version__ = "0.61.0"
@@ -310,6 +310,12 @@ def parse_args(args=None):
310
310
  dest="include_milestones",
311
311
  help="include milestones in backup",
312
312
  )
313
+ parser.add_argument(
314
+ "--security-advisories",
315
+ action="store_true",
316
+ dest="include_security_advisories",
317
+ help="include security advisories in backup",
318
+ )
313
319
  parser.add_argument(
314
320
  "--repositories",
315
321
  action="store_true",
@@ -1718,6 +1724,9 @@ def backup_repositories(args, output_directory, repositories):
1718
1724
  if args.include_milestones or args.include_everything:
1719
1725
  backup_milestones(args, repo_cwd, repository, repos_template)
1720
1726
 
1727
+ if args.include_security_advisories or args.include_everything:
1728
+ backup_security_advisories(args, repo_cwd, repository, repos_template)
1729
+
1721
1730
  if args.include_labels or args.include_everything:
1722
1731
  backup_labels(args, repo_cwd, repository, repos_template)
1723
1732
 
@@ -1934,6 +1943,41 @@ def backup_milestones(args, repo_cwd, repository, repos_template):
1934
1943
  )
1935
1944
 
1936
1945
 
1946
+ def backup_security_advisories(args, repo_cwd, repository, repos_template):
1947
+ advisory_cwd = os.path.join(repo_cwd, "security-advisories")
1948
+ if args.skip_existing and os.path.isdir(advisory_cwd):
1949
+ return
1950
+
1951
+ logger.info("Retrieving {0} security advisories".format(repository["full_name"]))
1952
+ mkdir_p(repo_cwd, advisory_cwd)
1953
+
1954
+ template = "{0}/{1}/security-advisories".format(repos_template, repository["full_name"])
1955
+
1956
+ _advisories = retrieve_data(args, template)
1957
+
1958
+ advisories = {}
1959
+ for advisory in _advisories:
1960
+ advisories[advisory["ghsa_id"]] = advisory
1961
+
1962
+ written_count = 0
1963
+ for ghsa_id, advisory in list(advisories.items()):
1964
+ advisory_file = "{0}/{1}.json".format(advisory_cwd, ghsa_id)
1965
+ if json_dump_if_changed(advisory, advisory_file):
1966
+ written_count += 1
1967
+
1968
+ total = len(advisories)
1969
+ if written_count == total:
1970
+ logger.info("Saved {0} security advisories to disk".format(total))
1971
+ elif written_count == 0:
1972
+ logger.info("{0} security advisories unchanged, skipped write".format(total))
1973
+ else:
1974
+ logger.info(
1975
+ "Saved {0} of {1} security advisories to disk ({2} unchanged)".format(
1976
+ written_count, total, total - written_count
1977
+ )
1978
+ )
1979
+
1980
+
1937
1981
  def backup_labels(args, repo_cwd, repository, repos_template):
1938
1982
  label_cwd = os.path.join(repo_cwd, "labels")
1939
1983
  output_file = "{0}/labels.json".format(label_cwd)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: github-backup
3
- Version: 0.60.0
3
+ Version: 0.61.0
4
4
  Summary: backup a github user or organization
5
5
  Home-page: http://github.com/josegonzalez/python-github-backup
6
6
  Author: Jose Diaz-Gonzalez
@@ -73,9 +73,9 @@ CLI Help output::
73
73
  [--watched] [--followers] [--following] [--all]
74
74
  [--issues] [--issue-comments] [--issue-events] [--pulls]
75
75
  [--pull-comments] [--pull-commits] [--pull-details]
76
- [--labels] [--hooks] [--milestones] [--repositories]
77
- [--bare] [--no-prune] [--lfs] [--wikis] [--gists]
78
- [--starred-gists] [--skip-archived] [--skip-existing]
76
+ [--labels] [--hooks] [--milestones] [--security-advisories]
77
+ [--repositories] [--bare] [--no-prune] [--lfs] [--wikis]
78
+ [--gists] [--starred-gists] [--skip-archived] [--skip-existing]
79
79
  [-L [LANGUAGES ...]] [-N NAME_REGEX] [-H GITHUB_HOST]
80
80
  [-O] [-R REPOSITORY] [-P] [-F] [--prefer-ssh] [-v]
81
81
  [--keychain-name OSX_KEYCHAIN_ITEM_NAME]
@@ -85,7 +85,7 @@ CLI Help output::
85
85
  [--skip-assets-on [SKIP_ASSETS_ON ...]] [--attachments]
86
86
  [--throttle-limit THROTTLE_LIMIT]
87
87
  [--throttle-pause THROTTLE_PAUSE]
88
- [--exclude [EXCLUDE ...]]
88
+ [--exclude [EXCLUDE ...]] [--retries MAX_RETRIES]
89
89
  USER
90
90
 
91
91
  Backup a github account
@@ -131,6 +131,8 @@ CLI Help output::
131
131
  --hooks include hooks in backup (works only when
132
132
  authenticated)
133
133
  --milestones include milestones in backup
134
+ --security-advisories
135
+ include security advisories in backup
134
136
  --repositories include repository clone in backup
135
137
  --bare clone bare repositories
136
138
  --no-prune disable prune option for git fetch
@@ -431,7 +433,7 @@ Quietly and incrementally backup useful Github user data (public and private rep
431
433
  export FINE_ACCESS_TOKEN=SOME-GITHUB-TOKEN
432
434
  GH_USER=YOUR-GITHUB-USER
433
435
 
434
- github-backup -f $FINE_ACCESS_TOKEN --prefer-ssh -o ~/github-backup/ -l error -P -i --all-starred --starred --watched --followers --following --issues --issue-comments --issue-events --pulls --pull-comments --pull-commits --labels --milestones --repositories --wikis --releases --assets --attachments --pull-details --gists --starred-gists $GH_USER
436
+ github-backup -f $FINE_ACCESS_TOKEN --prefer-ssh -o ~/github-backup/ -l error -P -i --all-starred --starred --watched --followers --following --issues --issue-comments --issue-events --pulls --pull-comments --pull-commits --labels --milestones --security-advisories --repositories --wikis --releases --assets --attachments --pull-details --gists --starred-gists $GH_USER
435
437
 
436
438
  Debug an error/block or incomplete backup into a temporary directory. Omit "incremental" to fill a previous incomplete backup. ::
437
439
 
@@ -37,6 +37,7 @@ class TestAllStarredCloning:
37
37
  args.include_labels = False
38
38
  args.include_hooks = False
39
39
  args.include_milestones = False
40
+ args.include_security_advisories = False
40
41
  args.include_releases = False
41
42
  args.include_assets = False
42
43
  args.include_attachments = False
@@ -1 +0,0 @@
1
- __version__ = "0.60.0"
File without changes
File without changes