Skip to content

Commit ef99048

Browse files
committed
Add GitHub Apps documentation and remove outdated header
- Add GitHub Apps authentication section with setup steps and CI/CD workflow example using actions/create-github-app-token - Remove outdated machine-man-preview header (graduated 2020) Closes #189
1 parent 3a513b6 commit ef99048

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

README.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,37 @@ Customise the permissions for your use case, but for a personal account full bac
174174
**Repository permissions**: Read access to contents, issues, metadata, pull requests, and webhooks.
175175

176176

177+
GitHub Apps
178+
~~~~~~~~~~~
179+
180+
GitHub Apps are ideal for organization backups in CI/CD. Tokens are scoped to specific repositories and expire after 1 hour.
181+
182+
**One-time setup:**
183+
184+
1. Create a GitHub App at *Settings -> Developer Settings -> GitHub Apps -> New GitHub App*
185+
2. Set a name and homepage URL (can be any URL)
186+
3. Uncheck "Webhook > Active" (not needed for backups)
187+
4. Set permissions (same as fine-grained tokens above)
188+
5. Click "Create GitHub App", then note the **App ID** shown on the next page
189+
6. Under "Private keys", click "Generate a private key" and save the downloaded file
190+
7. Go to *Install App* in your app's settings
191+
8. Select the account/organization and which repositories to back up
192+
193+
**CI/CD usage with GitHub Actions:**
194+
195+
Store the App ID as a repository variable and the private key contents as a secret, then use ``actions/create-github-app-token``::
196+
197+
- uses: actions/create-github-app-token@v1
198+
id: app-token
199+
with:
200+
app-id: ${{ vars.APP_ID }}
201+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
202+
203+
- run: github-backup myorg -t ${{ steps.app-token.outputs.token }} --as-app -o ./backup --all
204+
205+
Note: Installation tokens expire after 1 hour. For long-running backups, use a fine-grained personal access token instead.
206+
207+
177208
Prefer SSH
178209
~~~~~~~~~~
179210

github_backup/github_backup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,9 +796,6 @@ def _construct_request(
796796
else:
797797
auth = auth.encode("ascii")
798798
request.add_header("Authorization", "token ".encode("ascii") + auth)
799-
request.add_header(
800-
"Accept", "application/vnd.github.machine-man-preview+json"
801-
)
802799

803800
log_url = template if "?" not in template else template.split("?")[0]
804801
if querystring:

0 commit comments

Comments
 (0)