@@ -177,6 +177,37 @@ Customise the permissions for your use case, but for a personal account full bac
177177**Repository permissions **: Read access to contents, issues, metadata, pull requests, and webhooks.
178178
179179
180+ GitHub Apps
181+ ~~~~~~~~~~~
182+
183+ GitHub Apps are ideal for organization backups in CI/CD. Tokens are scoped to specific repositories and expire after 1 hour.
184+
185+ **One-time setup: **
186+
187+ 1. Create a GitHub App at *Settings -> Developer Settings -> GitHub Apps -> New GitHub App *
188+ 2. Set a name and homepage URL (can be any URL)
189+ 3. Uncheck "Webhook > Active" (not needed for backups)
190+ 4. Set permissions (same as fine-grained tokens above)
191+ 5. Click "Create GitHub App", then note the **App ID ** shown on the next page
192+ 6. Under "Private keys", click "Generate a private key" and save the downloaded file
193+ 7. Go to *Install App * in your app's settings
194+ 8. Select the account/organization and which repositories to back up
195+
196+ **CI/CD usage with GitHub Actions: **
197+
198+ Store the App ID as a repository variable and the private key contents as a secret, then use ``actions/create-github-app-token ``::
199+
200+ - uses: actions/create-github-app-token@v1
201+ id: app-token
202+ with:
203+ app-id: ${{ vars.APP_ID }}
204+ private-key: ${{ secrets.APP_PRIVATE_KEY }}
205+
206+ - run: github-backup myorg -t ${{ steps.app-token.outputs.token }} --as-app -o ./backup --all
207+
208+ Note: Installation tokens expire after 1 hour. For long-running backups, use a fine-grained personal access token instead.
209+
210+
180211Prefer SSH
181212~~~~~~~~~~
182213
@@ -364,6 +395,9 @@ Debug an error/block or incomplete backup into a temporary directory. Omit "incr
364395
365396 github-backup -f $FINE_ACCESS_TOKEN -o /tmp/github-backup/ -l debug -P --all-starred --starred --watched --followers --following --issues --issue-comments --issue-events --pulls --pull-comments --pull-commits --labels --milestones --repositories --wikis --releases --assets --pull-details --gists --starred-gists $GH_USER
366397
398+ Pipe a token from stdin to avoid storing it in environment variables or command history (Unix-like systems only)::
399+
400+ my-secret-manager get github-token | github-backup user -t file:///dev/stdin -o /backup --repositories
367401
368402Restoring from Backup
369403=====================
0 commit comments