GitHub Actions Tutorial — GitHub Apps
GitHub Apps
The default GITHUB_TOKEN has limitations — it can’t trigger other workflows, has limited rate limits, and its permissions are scoped to the current repository. GitHub Apps solve these problems.
When to Use a GitHub App
| Scenario | GITHUB_TOKEN | GitHub App |
|---|---|---|
| Checkout code | ✅ | ✅ |
| Comment on PRs | ✅ | ✅ |
| Trigger other workflows | ❌ | ✅ |
| Cross-repo operations | ❌ | ✅ |
| Higher API rate limits | 1,000/hr | 5,000/hr |
| Fine-grained permissions | ✅ | ✅ |
Creating a GitHub App
- Organization Settings → Developer settings → GitHub Apps → New GitHub App
- Set required permissions (e.g., contents: write, pull-requests: write)
- Install the app on your organization or specific repositories
- Note the App ID and generate a private key
Using a GitHub App in Workflows
Use the actions/create-github-app-token action to generate a token:
jobs:
automation:
runs-on: ubuntu-latest
steps:
- name: Generate App Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- name: Create PR (will trigger other workflows)
run: |
git checkout -b automated-update
echo "update" >> file.txt
git add . && git commit -m "Automated update"
git push origin automated-update
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Open PR
run: gh pr create --title "Automated Update" --body "Bot PR"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
PRs created with App tokens will trigger CI workflows (unlike GITHUB_TOKEN).
Common Use Cases
| Use Case | Why App Token |
|---|---|
| Automated dependency updates | PRs trigger CI |
| Cross-repo releases | Access other repos |
| Bot PRs and comments | Higher rate limits |
| Repository management | Admin-level operations |
Quick Reference
| Concept | Detail |
|---|---|
| Create | Org Settings → Developer → GitHub Apps |
| Secrets | APP_ID + APP_PRIVATE_KEY |
| Token action | actions/create-github-app-token@v1 |
| Rate limit | 5,000 requests/hour per installation |
| Key benefit | Tokens trigger other workflows |
← Previous: Advanced Patterns
Next: Non-CI/CD Automation →