You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+23-11Lines changed: 23 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ github-backup
4
4
5
5
|PyPI| |Python Versions|
6
6
7
-
The package can be used to backup an *entire* `Github <https://github.com/>`_ organization, repository or user account, including starred repos, issuesand wikis in the most appropriate format (clones for wikis, json files for issues).
7
+
The package can be used to backup an *entire* `Github <https://github.com/>`_ organization, repository or user account, including starred repos, issues, discussions and wikis in the most appropriate format (clones for wikis, json files for issues and discussions).
--attachments download user-attachments from issues and pull
148
-
requests
149
+
--attachments download user-attachments from issues, pull requests,
150
+
and discussions
149
151
--throttle-limit THROTTLE_LIMIT
150
152
start throttling of GitHub API requests after this
151
153
amount of API requests remain
@@ -184,7 +186,7 @@ Customise the permissions for your use case, but for a personal account full bac
184
186
185
187
**User permissions**: Read access to followers, starring, and watching.
186
188
187
-
**Repository permissions**: Read access to contents, issues, metadata, pull requests, and webhooks.
189
+
**Repository permissions**: Read access to contents, discussions, issues, metadata, pull requests, and webhooks.
188
190
189
191
190
192
GitHub Apps
@@ -265,9 +267,9 @@ LFS objects are fetched for all refs, not just the current checkout, ensuring a
265
267
About Attachments
266
268
-----------------
267
269
268
-
When you use the ``--attachments`` option with ``--issues``or ``--pulls``, the tool will download user-uploaded attachments (images, videos, documents, etc.) from issue and pull request descriptions and comments. In some circumstances attachments contain valuable data related to the topic, and without their backup important information or context might be lost inadvertently.
270
+
When you use the ``--attachments`` option with ``--issues``, ``--pulls`` or ``--discussions``, the tool will download user-uploaded attachments (images, videos, documents, etc.) from issue, pull request and discussion descriptions and comments. In some circumstances attachments contain valuable data related to the topic, and without their backup important information or context might be lost inadvertently.
269
271
270
-
Attachments are saved to ``issues/attachments/{issue_number}/`` and ``pulls/attachments/{pull_number}/`` directories, where ``{issue_number}`` is the GitHub issue number (e.g., issue #123 saves to ``issues/attachments/123/``). Each attachment directory contains:
272
+
Attachments are saved to ``issues/attachments/{issue_number}/``, ``pulls/attachments/{pull_number}/`` and ``discussions/attachments/{discussion_number}/`` directories, where ``{issue_number}`` is the GitHub issue number (e.g., issue #123 saves to ``issues/attachments/123/``). Each attachment directory contains:
271
273
272
274
- The downloaded attachment files (named by their GitHub identifier with appropriate file extensions)
273
275
- If multiple attachments have the same filename, conflicts are resolved with numeric suffixes (e.g., ``report.pdf``, ``report_1.pdf``, ``report_2.pdf``)
@@ -287,6 +289,16 @@ The tool automatically extracts file extensions from HTTP headers to ensure file
287
289
**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 both ``/assets/`` (images) and ``/files/`` (documents) URLs. 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. However, this workaround only works for images - document attachments (PDFs, text files, etc.) will fail with 404 errors when using fine-grained tokens on private repos. For full attachment support on private repositories, use a classic token (``-t``) instead of a fine-grained token (``-f``). See `#477 <https://github.com/josegonzalez/python-github-backup/issues/477>`_ for details.
288
290
289
291
292
+
About Discussions
293
+
-----------------
294
+
295
+
GitHub Discussions are backed up with GitHub's GraphQL API because the REST API does not expose discussions. Use ``--discussions`` to save each discussion as JSON under ``repositories/{repo}/discussions/{number}.json``. Discussion backups include the discussion body and metadata, category information, comments, and comment replies.
296
+
297
+
``--discussions`` is included in ``--all``. Unlike most REST API-backed resources, discussions require authentication because GitHub's GraphQL API requires a token. Fine-grained personal access tokens and GitHub Apps need read access to the repository's Discussions permission.
298
+
299
+
Incremental backups use a per-repository checkpoint at ``repositories/{repo}/discussions/last_update`` based on discussion ``updatedAt`` timestamps. This is separate from the repository-level ``last_update`` file so discussion activity is not missed if the repository's own update timestamp does not change. If you enable ``--discussions`` on an existing incremental backup, the first run performs a full discussions backup for each repository and creates the discussions checkpoint for future runs.
300
+
301
+
290
302
About security advisories
291
303
-------------------------
292
304
@@ -419,14 +431,14 @@ Quietly and incrementally backup useful Github user data (public and private rep
**Issues, pull requests, comments, and other metadata** are saved as JSON files for archival purposes. The GitHub API does not support recreating this data faithfully, creating issues via the API has limitations:
457
+
**Issues, pull requests, discussions, comments, and other metadata** are saved as JSON files for archival purposes. The GitHub API does not support recreating this data faithfully, creating issues via the API has limitations:
446
458
447
459
- New issue/PR numbers are assigned (original numbers cannot be set)
448
460
- Timestamps reflect creation time (original dates cannot be set)
0 commit comments