github-backup 0.67.0__tar.gz → 0.69.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.
- {github_backup-0.67.0 → github_backup-0.69.0}/CHANGES.rst +96 -1
- {github_backup-0.67.0/github_backup.egg-info → github_backup-0.69.0}/PKG-INFO +31 -7
- {github_backup-0.67.0 → github_backup-0.69.0}/README +29 -6
- {github_backup-0.67.0 → github_backup-0.69.0}/README.rst +29 -6
- github_backup-0.69.0/github_backup/__init__.py +1 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/github_backup/github_backup.py +363 -53
- {github_backup-0.67.0 → github_backup-0.69.0}/github_backup/graphql_queries.py +67 -0
- {github_backup-0.67.0 → github_backup-0.69.0/github_backup.egg-info}/PKG-INFO +31 -7
- {github_backup-0.67.0 → github_backup-0.69.0}/github_backup.egg-info/SOURCES.txt +3 -1
- {github_backup-0.67.0 → github_backup-0.69.0}/release-requirements.txt +1 -1
- {github_backup-0.67.0 → github_backup-0.69.0}/setup.py +1 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_all_starred.py +12 -0
- github_backup-0.69.0/tests/test_app_auth.py +425 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_attachments.py +66 -28
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_incremental_per_repository.py +3 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_json_dump_if_changed.py +7 -8
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_skip_assets_on.py +3 -0
- github_backup-0.69.0/tests/test_temporary_private_forks.py +136 -0
- github_backup-0.67.0/github_backup/__init__.py +0 -1
- {github_backup-0.67.0 → github_backup-0.69.0}/LICENSE.txt +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/MANIFEST.in +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/github_backup/__main__.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/github_backup/cli.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/github_backup.egg-info/dependency_links.txt +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/github_backup.egg-info/entry_points.txt +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/github_backup.egg-info/top_level.txt +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/github_backup.egg-info/zip-safe +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/requirements.txt +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/setup.cfg +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_app_repositories.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_auth.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_case_sensitivity.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_disabled_issues_pulls.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_discussions.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_gists.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_hooks.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_http_451.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_incremental_by_files.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_issue_timeline.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_logging_subprocess.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_pagination.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_pull_incremental_pagination.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_pull_reviews.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_releases.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_retrieve_data.py +0 -0
- {github_backup-0.67.0 → github_backup-0.69.0}/tests/test_starred_skip_size_over.py +0 -0
|
@@ -1,9 +1,104 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
-
0.
|
|
4
|
+
0.69.0 (2026-11-26)
|
|
5
5
|
-------------------
|
|
6
6
|
------------------------
|
|
7
|
+
- Test GraphQL pagination in pull comments retrieval. [Jakub Kuczys]
|
|
8
|
+
- Avoid making empty dirs for labels, milestones, and releases. [Jakub
|
|
9
|
+
Kuczys]
|
|
10
|
+
- Add end-to-end test. [Jakub Kuczys]
|
|
11
|
+
- Try REST API for comments before GraphQL. [Jakub Kuczys]
|
|
12
|
+
- Assume has_pull_requests may not be present per API docs. [Jakub
|
|
13
|
+
Kuczys]
|
|
14
|
+
- Add missing fields to test cases. [Jakub Kuczys]
|
|
15
|
+
- Fix handling of temporary private forks. [Jakub Kuczys]
|
|
16
|
+
- Use the Markdown API workaround for GitHub App tokens and repo-scoped
|
|
17
|
+
image URLs. [Claude Opus 5.5, Takahiro Yamashita]
|
|
18
|
+
|
|
19
|
+
GitHub App installation tokens get the same 404 as fine-grained PATs when
|
|
20
|
+
downloading attachments from private repositories (#477), but the workaround
|
|
21
|
+
was only used with -f. Older github.com/{owner}/{repo}/assets/* image URLs
|
|
22
|
+
also 404 with both token types and render to the same JWT-signed URLs.
|
|
23
|
+
|
|
24
|
+
Move the check into needs_jwt_workaround() so it can be tested directly,
|
|
25
|
+
and pass the current token from get_auth() so App tokens are refreshed.
|
|
26
|
+
|
|
27
|
+
The README now also notes that the workaround needs read access to
|
|
28
|
+
contents: without it, POST /markdown returns 200 but leaves the image URLs
|
|
29
|
+
unsigned.
|
|
30
|
+
- Add Python 3.15 to CI and classifiers. [Rodos]
|
|
31
|
+
|
|
32
|
+
Python 3.15 was released on 2026-10-09 and already works. Add it to the
|
|
33
|
+
package classifiers and the CI test and lint matrices.
|
|
34
|
+
- Replace deprecated codecs.open with open. [Rodos]
|
|
35
|
+
|
|
36
|
+
codecs.open() is deprecated since Python 3.14 and warns on every call.
|
|
37
|
+
Use the built-in open() with newline="" instead, which like codecs.open()
|
|
38
|
+
does not translate line endings, so the files written are unchanged on
|
|
39
|
+
every platform.
|
|
40
|
+
- Resolve the app token again when retrying after a rate-limit wait.
|
|
41
|
+
[Claude Opus 5.5, Takahiro Yamashita]
|
|
42
|
+
|
|
43
|
+
make_request_with_retry resent the Request it was given, so a retry kept
|
|
44
|
+
the Authorization header from the first attempt. With --app-id the rate
|
|
45
|
+
limit window and the installation token both start at the beginning of
|
|
46
|
+
the run, so when the limit is used up within that hour, the wait for
|
|
47
|
+
x-ratelimit-reset ends right after the token expires and the retry fails
|
|
48
|
+
with 401, which stops the backup.
|
|
49
|
+
|
|
50
|
+
make_request_with_retry now takes an optional rebuild_request callable
|
|
51
|
+
and uses it to build each retry. retrieve_data and retrieve_graphql_data
|
|
52
|
+
pass one that resolves the token through get_auth again, which creates a
|
|
53
|
+
new installation token when the cached one is about to expire.
|
|
54
|
+
|
|
55
|
+
retrieve_graphql_data also resolved the token once per call, so its own
|
|
56
|
+
retry on a RATE_LIMITED error had the same problem. It now resolves the
|
|
57
|
+
token again for each attempt after the first.
|
|
58
|
+
- Add AGENTS.md with contribution guidance for coding agents. [Rodos]
|
|
59
|
+
|
|
60
|
+
Document the conventions that reviews of past pull requests have settled
|
|
61
|
+
on, so agent-written contributions follow them and are easier to review.
|
|
62
|
+
Point to it from the README, and match the README flake8 command to CI.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
0.68.0 (2026-11-09)
|
|
66
|
+
-------------------
|
|
67
|
+
- Create GitHub App installation tokens from the app's private key. [AC
|
|
68
|
+
Capehart, Claude Opus 5.5]
|
|
69
|
+
|
|
70
|
+
--as-app only accepts an installation token created elsewhere. Those
|
|
71
|
+
expire after an hour, so long backups fail part way through. With
|
|
72
|
+
--app-id and --app-private-key, github-backup creates the token itself
|
|
73
|
+
and replaces it ten minutes before it expires. The installation is
|
|
74
|
+
looked up from the user or organization being backed up, unless
|
|
75
|
+
--app-installation-id names it.
|
|
76
|
+
|
|
77
|
+
The JWT is signed by the openssl command line tool so the project keeps
|
|
78
|
+
zero runtime dependencies; the Docker image now installs openssl. A
|
|
79
|
+
missing key file or openssl is reported by parse_args before any work
|
|
80
|
+
starts. API requests resolve auth per request, and wiki clones rebuild
|
|
81
|
+
their URL, so both pick up a refreshed token mid-run.
|
|
82
|
+
- Chore(deps): bump flake8. [dependabot[bot]]
|
|
83
|
+
|
|
84
|
+
Bumps the python-packages group with 1 update: [flake8](https://github.com/pycqa/flake8).
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
Updates `flake8` from 7.4.1 to 7.5.0
|
|
88
|
+
- [Commits](https://github.com/pycqa/flake8/compare/7.4.1...7.5.0)
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
updated-dependencies:
|
|
92
|
+
- dependency-name: flake8
|
|
93
|
+
dependency-version: 7.5.0
|
|
94
|
+
dependency-type: direct:production
|
|
95
|
+
update-type: version-update:semver-minor
|
|
96
|
+
dependency-group: python-packages
|
|
97
|
+
...
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
0.67.0 (2026-11-04)
|
|
101
|
+
-------------------
|
|
7
102
|
- Drop support for Python 3.10 (end of life) [Rodos]
|
|
8
103
|
|
|
9
104
|
Python 3.10 reached end of life on 2026-10-01 and no longer receives
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: github-backup
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.69.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
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
16
17
|
Requires-Python: >=3.11
|
|
17
18
|
Description-Content-Type: text/x-rst
|
|
18
19
|
License-File: LICENSE.txt
|
|
@@ -66,7 +67,10 @@ Show the CLI help output::
|
|
|
66
67
|
CLI Help output::
|
|
67
68
|
|
|
68
69
|
github-backup [-h] [-t TOKEN_CLASSIC] [-f TOKEN_FINE] [--token-from-gh]
|
|
69
|
-
[-q] [--as-app] [-
|
|
70
|
+
[-q] [--as-app] [--app-id APP_ID]
|
|
71
|
+
[--app-private-key APP_PRIVATE_KEY]
|
|
72
|
+
[--app-installation-id APP_INSTALLATION_ID]
|
|
73
|
+
[-o OUTPUT_DIRECTORY] [-l LOG_LEVEL] [-i]
|
|
70
74
|
[--incremental-by-files]
|
|
71
75
|
[--starred] [--all-starred] [--starred-skip-size-over MB]
|
|
72
76
|
[--watched] [--followers] [--following] [--all]
|
|
@@ -107,6 +111,14 @@ CLI Help output::
|
|
|
107
111
|
-q, --quiet supress log messages less severe than warning, e.g.
|
|
108
112
|
info
|
|
109
113
|
--as-app authenticate as github app instead of as a user.
|
|
114
|
+
--app-id APP_ID github app id or client id; creates and refreshes
|
|
115
|
+
installation tokens (implies --as-app)
|
|
116
|
+
--app-private-key APP_PRIVATE_KEY
|
|
117
|
+
path to the github app private key (.pem), optionally
|
|
118
|
+
as file://...
|
|
119
|
+
--app-installation-id APP_INSTALLATION_ID
|
|
120
|
+
id of the github app installation to back up
|
|
121
|
+
(default: looked up from the user or organization)
|
|
110
122
|
-o, --output-directory OUTPUT_DIRECTORY
|
|
111
123
|
directory at which to backup the repositories
|
|
112
124
|
-l, --log-level LOG_LEVEL
|
|
@@ -241,9 +253,19 @@ For a user account (no ``--organization``), ``--as-app`` lists the repositories
|
|
|
241
253
|
7. Go to *Install App* in your app's settings
|
|
242
254
|
8. Select the account/organization and which repositories to back up
|
|
243
255
|
|
|
244
|
-
**
|
|
256
|
+
**Using the app's private key:**
|
|
245
257
|
|
|
246
|
-
|
|
258
|
+
Pass the App ID and private key file, and github-backup creates installation tokens itself, refreshing them before they expire so long-running backups keep working::
|
|
259
|
+
|
|
260
|
+
github-backup myorg --organization --app-id 12345 --app-private-key /path/to/app.private-key.pem -o ./backup --all
|
|
261
|
+
|
|
262
|
+
The app's installation on the user or organization being backed up is looked up automatically. To skip the lookup, pass ``--app-installation-id`` with the number at the end of the installation's settings URL (``.../settings/installations/<id>``).
|
|
263
|
+
|
|
264
|
+
``--app-id`` implies ``--as-app`` and cannot be combined with ``-t``, ``-f``, ``--token-from-gh`` or the keychain options. The ``iss`` claim of the signed JWT is set to the value of ``--app-id``, so the app's client ID works there too. The JWT is signed by the ``openssl`` command line tool, which must be on your ``PATH`` (the Docker image includes it).
|
|
265
|
+
|
|
266
|
+
**Using an existing installation token:**
|
|
267
|
+
|
|
268
|
+
If something else already creates the installation token, pass it with ``-t`` and ``--as-app``. In GitHub Actions, store the App ID as a repository variable and the private key contents as a secret, then use ``actions/create-github-app-token``::
|
|
247
269
|
|
|
248
270
|
- uses: actions/create-github-app-token@v1
|
|
249
271
|
id: app-token
|
|
@@ -253,7 +275,7 @@ Store the App ID as a repository variable and the private key contents as a secr
|
|
|
253
275
|
|
|
254
276
|
- run: github-backup myorg -t ${{ steps.app-token.outputs.token }} --as-app -o ./backup --all
|
|
255
277
|
|
|
256
|
-
Note: Installation tokens expire after 1 hour. For
|
|
278
|
+
Note: Installation tokens passed with ``-t`` expire after 1 hour and are not refreshed. For backups that may run longer, use ``--app-private-key`` instead.
|
|
257
279
|
|
|
258
280
|
|
|
259
281
|
Prefer SSH
|
|
@@ -322,7 +344,7 @@ The tool automatically extracts file extensions from HTTP headers to ensure file
|
|
|
322
344
|
|
|
323
345
|
**Repository filtering** for repo files/assets handles renamed and transferred repositories gracefully. URLs are included if they either match the current repository name directly, or redirect to it (e.g., ``willmcgugan/rich`` redirects to ``Textualize/rich`` after transfer).
|
|
324
346
|
|
|
325
|
-
**Fine-grained token limitation:** Due to a GitHub platform limitation, fine-grained personal access tokens (``github_pat_...``) cannot download attachments from private repositories directly. This affects
|
|
347
|
+
**Fine-grained and GitHub App token limitation:** Due to a GitHub platform limitation, fine-grained personal access tokens (``github_pat_...``) and GitHub App installation tokens (``--as-app`` or ``--app-id``) cannot download attachments from private repositories directly. This affects ``/assets/`` (images) and ``/files/`` (documents) URLs, in both the ``github.com/user-attachments/`` and the older ``github.com/{owner}/{repo}/`` format. The tool implements a workaround for image attachments using GitHub's Markdown API, which converts URLs to temporary JWT-signed URLs that can be downloaded. The token needs read access to contents for this (included in the permissions above); without it, the Markdown API still responds but does not sign the image URLs. However, this workaround only works for images - document attachments (PDFs, text files, etc.) will fail with 404 errors when using these tokens on private repos. For full attachment support on private repositories, use a classic token (``-t``) instead. See `#477 <https://github.com/josegonzalez/python-github-backup/issues/477>`_ for details.
|
|
326
348
|
|
|
327
349
|
|
|
328
350
|
About Discussions
|
|
@@ -541,6 +563,8 @@ Development
|
|
|
541
563
|
|
|
542
564
|
This project is considered feature complete for the primary maintainer @josegonzalez. If you would like a bugfix or enhancement, pull requests are welcome. Feel free to contact the maintainer for consulting estimates if you'd like to sponsor the work instead.
|
|
543
565
|
|
|
566
|
+
If you use a coding agent, point it at `AGENTS.md <AGENTS.md>`_, which collects the conventions that reviews of past pull requests have settled on.
|
|
567
|
+
|
|
544
568
|
Contibuters
|
|
545
569
|
-----------
|
|
546
570
|
|
|
@@ -561,7 +585,7 @@ To run the test suite::
|
|
|
561
585
|
To run linting::
|
|
562
586
|
|
|
563
587
|
pip install flake8
|
|
564
|
-
flake8 --ignore=E501
|
|
588
|
+
flake8 --ignore=E501,E203,W503
|
|
565
589
|
|
|
566
590
|
|
|
567
591
|
.. |PyPI| image:: https://img.shields.io/pypi/v/github-backup.svg
|
|
@@ -37,7 +37,10 @@ Show the CLI help output::
|
|
|
37
37
|
CLI Help output::
|
|
38
38
|
|
|
39
39
|
github-backup [-h] [-t TOKEN_CLASSIC] [-f TOKEN_FINE] [--token-from-gh]
|
|
40
|
-
[-q] [--as-app] [-
|
|
40
|
+
[-q] [--as-app] [--app-id APP_ID]
|
|
41
|
+
[--app-private-key APP_PRIVATE_KEY]
|
|
42
|
+
[--app-installation-id APP_INSTALLATION_ID]
|
|
43
|
+
[-o OUTPUT_DIRECTORY] [-l LOG_LEVEL] [-i]
|
|
41
44
|
[--incremental-by-files]
|
|
42
45
|
[--starred] [--all-starred] [--starred-skip-size-over MB]
|
|
43
46
|
[--watched] [--followers] [--following] [--all]
|
|
@@ -78,6 +81,14 @@ CLI Help output::
|
|
|
78
81
|
-q, --quiet supress log messages less severe than warning, e.g.
|
|
79
82
|
info
|
|
80
83
|
--as-app authenticate as github app instead of as a user.
|
|
84
|
+
--app-id APP_ID github app id or client id; creates and refreshes
|
|
85
|
+
installation tokens (implies --as-app)
|
|
86
|
+
--app-private-key APP_PRIVATE_KEY
|
|
87
|
+
path to the github app private key (.pem), optionally
|
|
88
|
+
as file://...
|
|
89
|
+
--app-installation-id APP_INSTALLATION_ID
|
|
90
|
+
id of the github app installation to back up
|
|
91
|
+
(default: looked up from the user or organization)
|
|
81
92
|
-o, --output-directory OUTPUT_DIRECTORY
|
|
82
93
|
directory at which to backup the repositories
|
|
83
94
|
-l, --log-level LOG_LEVEL
|
|
@@ -212,9 +223,19 @@ For a user account (no ``--organization``), ``--as-app`` lists the repositories
|
|
|
212
223
|
7. Go to *Install App* in your app's settings
|
|
213
224
|
8. Select the account/organization and which repositories to back up
|
|
214
225
|
|
|
215
|
-
**
|
|
226
|
+
**Using the app's private key:**
|
|
216
227
|
|
|
217
|
-
|
|
228
|
+
Pass the App ID and private key file, and github-backup creates installation tokens itself, refreshing them before they expire so long-running backups keep working::
|
|
229
|
+
|
|
230
|
+
github-backup myorg --organization --app-id 12345 --app-private-key /path/to/app.private-key.pem -o ./backup --all
|
|
231
|
+
|
|
232
|
+
The app's installation on the user or organization being backed up is looked up automatically. To skip the lookup, pass ``--app-installation-id`` with the number at the end of the installation's settings URL (``.../settings/installations/<id>``).
|
|
233
|
+
|
|
234
|
+
``--app-id`` implies ``--as-app`` and cannot be combined with ``-t``, ``-f``, ``--token-from-gh`` or the keychain options. The ``iss`` claim of the signed JWT is set to the value of ``--app-id``, so the app's client ID works there too. The JWT is signed by the ``openssl`` command line tool, which must be on your ``PATH`` (the Docker image includes it).
|
|
235
|
+
|
|
236
|
+
**Using an existing installation token:**
|
|
237
|
+
|
|
238
|
+
If something else already creates the installation token, pass it with ``-t`` and ``--as-app``. In GitHub Actions, store the App ID as a repository variable and the private key contents as a secret, then use ``actions/create-github-app-token``::
|
|
218
239
|
|
|
219
240
|
- uses: actions/create-github-app-token@v1
|
|
220
241
|
id: app-token
|
|
@@ -224,7 +245,7 @@ Store the App ID as a repository variable and the private key contents as a secr
|
|
|
224
245
|
|
|
225
246
|
- run: github-backup myorg -t ${{ steps.app-token.outputs.token }} --as-app -o ./backup --all
|
|
226
247
|
|
|
227
|
-
Note: Installation tokens expire after 1 hour. For
|
|
248
|
+
Note: Installation tokens passed with ``-t`` expire after 1 hour and are not refreshed. For backups that may run longer, use ``--app-private-key`` instead.
|
|
228
249
|
|
|
229
250
|
|
|
230
251
|
Prefer SSH
|
|
@@ -293,7 +314,7 @@ The tool automatically extracts file extensions from HTTP headers to ensure file
|
|
|
293
314
|
|
|
294
315
|
**Repository filtering** for repo files/assets handles renamed and transferred repositories gracefully. URLs are included if they either match the current repository name directly, or redirect to it (e.g., ``willmcgugan/rich`` redirects to ``Textualize/rich`` after transfer).
|
|
295
316
|
|
|
296
|
-
**Fine-grained token limitation:** Due to a GitHub platform limitation, fine-grained personal access tokens (``github_pat_...``) cannot download attachments from private repositories directly. This affects
|
|
317
|
+
**Fine-grained and GitHub App token limitation:** Due to a GitHub platform limitation, fine-grained personal access tokens (``github_pat_...``) and GitHub App installation tokens (``--as-app`` or ``--app-id``) cannot download attachments from private repositories directly. This affects ``/assets/`` (images) and ``/files/`` (documents) URLs, in both the ``github.com/user-attachments/`` and the older ``github.com/{owner}/{repo}/`` format. The tool implements a workaround for image attachments using GitHub's Markdown API, which converts URLs to temporary JWT-signed URLs that can be downloaded. The token needs read access to contents for this (included in the permissions above); without it, the Markdown API still responds but does not sign the image URLs. However, this workaround only works for images - document attachments (PDFs, text files, etc.) will fail with 404 errors when using these tokens on private repos. For full attachment support on private repositories, use a classic token (``-t``) instead. See `#477 <https://github.com/josegonzalez/python-github-backup/issues/477>`_ for details.
|
|
297
318
|
|
|
298
319
|
|
|
299
320
|
About Discussions
|
|
@@ -512,6 +533,8 @@ Development
|
|
|
512
533
|
|
|
513
534
|
This project is considered feature complete for the primary maintainer @josegonzalez. If you would like a bugfix or enhancement, pull requests are welcome. Feel free to contact the maintainer for consulting estimates if you'd like to sponsor the work instead.
|
|
514
535
|
|
|
536
|
+
If you use a coding agent, point it at `AGENTS.md <AGENTS.md>`_, which collects the conventions that reviews of past pull requests have settled on.
|
|
537
|
+
|
|
515
538
|
Contibuters
|
|
516
539
|
-----------
|
|
517
540
|
|
|
@@ -532,7 +555,7 @@ To run the test suite::
|
|
|
532
555
|
To run linting::
|
|
533
556
|
|
|
534
557
|
pip install flake8
|
|
535
|
-
flake8 --ignore=E501
|
|
558
|
+
flake8 --ignore=E501,E203,W503
|
|
536
559
|
|
|
537
560
|
|
|
538
561
|
.. |PyPI| image:: https://img.shields.io/pypi/v/github-backup.svg
|
|
@@ -37,7 +37,10 @@ Show the CLI help output::
|
|
|
37
37
|
CLI Help output::
|
|
38
38
|
|
|
39
39
|
github-backup [-h] [-t TOKEN_CLASSIC] [-f TOKEN_FINE] [--token-from-gh]
|
|
40
|
-
[-q] [--as-app] [-
|
|
40
|
+
[-q] [--as-app] [--app-id APP_ID]
|
|
41
|
+
[--app-private-key APP_PRIVATE_KEY]
|
|
42
|
+
[--app-installation-id APP_INSTALLATION_ID]
|
|
43
|
+
[-o OUTPUT_DIRECTORY] [-l LOG_LEVEL] [-i]
|
|
41
44
|
[--incremental-by-files]
|
|
42
45
|
[--starred] [--all-starred] [--starred-skip-size-over MB]
|
|
43
46
|
[--watched] [--followers] [--following] [--all]
|
|
@@ -78,6 +81,14 @@ CLI Help output::
|
|
|
78
81
|
-q, --quiet supress log messages less severe than warning, e.g.
|
|
79
82
|
info
|
|
80
83
|
--as-app authenticate as github app instead of as a user.
|
|
84
|
+
--app-id APP_ID github app id or client id; creates and refreshes
|
|
85
|
+
installation tokens (implies --as-app)
|
|
86
|
+
--app-private-key APP_PRIVATE_KEY
|
|
87
|
+
path to the github app private key (.pem), optionally
|
|
88
|
+
as file://...
|
|
89
|
+
--app-installation-id APP_INSTALLATION_ID
|
|
90
|
+
id of the github app installation to back up
|
|
91
|
+
(default: looked up from the user or organization)
|
|
81
92
|
-o, --output-directory OUTPUT_DIRECTORY
|
|
82
93
|
directory at which to backup the repositories
|
|
83
94
|
-l, --log-level LOG_LEVEL
|
|
@@ -212,9 +223,19 @@ For a user account (no ``--organization``), ``--as-app`` lists the repositories
|
|
|
212
223
|
7. Go to *Install App* in your app's settings
|
|
213
224
|
8. Select the account/organization and which repositories to back up
|
|
214
225
|
|
|
215
|
-
**
|
|
226
|
+
**Using the app's private key:**
|
|
216
227
|
|
|
217
|
-
|
|
228
|
+
Pass the App ID and private key file, and github-backup creates installation tokens itself, refreshing them before they expire so long-running backups keep working::
|
|
229
|
+
|
|
230
|
+
github-backup myorg --organization --app-id 12345 --app-private-key /path/to/app.private-key.pem -o ./backup --all
|
|
231
|
+
|
|
232
|
+
The app's installation on the user or organization being backed up is looked up automatically. To skip the lookup, pass ``--app-installation-id`` with the number at the end of the installation's settings URL (``.../settings/installations/<id>``).
|
|
233
|
+
|
|
234
|
+
``--app-id`` implies ``--as-app`` and cannot be combined with ``-t``, ``-f``, ``--token-from-gh`` or the keychain options. The ``iss`` claim of the signed JWT is set to the value of ``--app-id``, so the app's client ID works there too. The JWT is signed by the ``openssl`` command line tool, which must be on your ``PATH`` (the Docker image includes it).
|
|
235
|
+
|
|
236
|
+
**Using an existing installation token:**
|
|
237
|
+
|
|
238
|
+
If something else already creates the installation token, pass it with ``-t`` and ``--as-app``. In GitHub Actions, store the App ID as a repository variable and the private key contents as a secret, then use ``actions/create-github-app-token``::
|
|
218
239
|
|
|
219
240
|
- uses: actions/create-github-app-token@v1
|
|
220
241
|
id: app-token
|
|
@@ -224,7 +245,7 @@ Store the App ID as a repository variable and the private key contents as a secr
|
|
|
224
245
|
|
|
225
246
|
- run: github-backup myorg -t ${{ steps.app-token.outputs.token }} --as-app -o ./backup --all
|
|
226
247
|
|
|
227
|
-
Note: Installation tokens expire after 1 hour. For
|
|
248
|
+
Note: Installation tokens passed with ``-t`` expire after 1 hour and are not refreshed. For backups that may run longer, use ``--app-private-key`` instead.
|
|
228
249
|
|
|
229
250
|
|
|
230
251
|
Prefer SSH
|
|
@@ -293,7 +314,7 @@ The tool automatically extracts file extensions from HTTP headers to ensure file
|
|
|
293
314
|
|
|
294
315
|
**Repository filtering** for repo files/assets handles renamed and transferred repositories gracefully. URLs are included if they either match the current repository name directly, or redirect to it (e.g., ``willmcgugan/rich`` redirects to ``Textualize/rich`` after transfer).
|
|
295
316
|
|
|
296
|
-
**Fine-grained token limitation:** Due to a GitHub platform limitation, fine-grained personal access tokens (``github_pat_...``) cannot download attachments from private repositories directly. This affects
|
|
317
|
+
**Fine-grained and GitHub App token limitation:** Due to a GitHub platform limitation, fine-grained personal access tokens (``github_pat_...``) and GitHub App installation tokens (``--as-app`` or ``--app-id``) cannot download attachments from private repositories directly. This affects ``/assets/`` (images) and ``/files/`` (documents) URLs, in both the ``github.com/user-attachments/`` and the older ``github.com/{owner}/{repo}/`` format. The tool implements a workaround for image attachments using GitHub's Markdown API, which converts URLs to temporary JWT-signed URLs that can be downloaded. The token needs read access to contents for this (included in the permissions above); without it, the Markdown API still responds but does not sign the image URLs. However, this workaround only works for images - document attachments (PDFs, text files, etc.) will fail with 404 errors when using these tokens on private repos. For full attachment support on private repositories, use a classic token (``-t``) instead. See `#477 <https://github.com/josegonzalez/python-github-backup/issues/477>`_ for details.
|
|
297
318
|
|
|
298
319
|
|
|
299
320
|
About Discussions
|
|
@@ -512,6 +533,8 @@ Development
|
|
|
512
533
|
|
|
513
534
|
This project is considered feature complete for the primary maintainer @josegonzalez. If you would like a bugfix or enhancement, pull requests are welcome. Feel free to contact the maintainer for consulting estimates if you'd like to sponsor the work instead.
|
|
514
535
|
|
|
536
|
+
If you use a coding agent, point it at `AGENTS.md <AGENTS.md>`_, which collects the conventions that reviews of past pull requests have settled on.
|
|
537
|
+
|
|
515
538
|
Contibuters
|
|
516
539
|
-----------
|
|
517
540
|
|
|
@@ -532,7 +555,7 @@ To run the test suite::
|
|
|
532
555
|
To run linting::
|
|
533
556
|
|
|
534
557
|
pip install flake8
|
|
535
|
-
flake8 --ignore=E501
|
|
558
|
+
flake8 --ignore=E501,E203,W503
|
|
536
559
|
|
|
537
560
|
|
|
538
561
|
.. |PyPI| image:: https://img.shields.io/pypi/v/github-backup.svg
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.69.0"
|