GitHub Integration
Connect GitHub to enable the AI agent to access code context, pull requests, and deployment information during investigations.
Capabilities
Once connected, the AI agent can:
| Capability | Description |
|---|---|
| Browse Code | View repository files and code |
| Search Code | Search across repositories |
| Pull Requests | Review recent PRs and changes |
| Commits | View commit history and diffs |
| Deployments | Check deployment status |
| Actions | Review workflow runs |
Prerequisites
- A GitHub account or organization
- A Personal Access Token (PAT) or GitHub App
- Read access to the repositories you want to query
Setup
You can use either a classic token or a fine-grained token. Classic tokens are required if your organization uses SAML SSO.
Classic token (GitHub docs):
- Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click Generate new token → Generate new token (classic)
- Give it a descriptive name
- Set an expiration date
- Select the
reposcope (grants read access to repositories) - Click Generate token and copy it
Fine-grained token (GitHub docs):
- Go to GitHub Settings → Developer settings → Personal access tokens → Fine-grained tokens
- Click Generate new token
- Set an expiration date
- Select the repositories to grant access
- Set permissions (see Required Permissions below)
- Click Generate token and copy it
If your GitHub organization uses SAML single sign-on (SSO), you must authorize the token for SSO access after creating it (GitHub docs):
- Go to Settings → Developer settings → Personal access tokens → Tokens (classic)
- Next to your token, click Configure SSO
- Click Authorize next to the organization you want to grant access to
Without SSO authorization, the token will return 403 errors when accessing organization resources, even with the correct scopes.
- Go to Integrations in Autoheal
- Click GitHub
- Enter a name (e.g., "Production GitHub")
Enter the following:
- Token: Your GitHub Personal Access Token
- Organization (optional): Limit to a specific org
Click Test Connection to verify, then Save.
Required Permissions
For fine-grained tokens, grant these permissions:
| Permission | Access Level | Why It's Needed |
|---|---|---|
| Contents | Read | View repository files |
| Metadata | Read | Access repository information |
| Pull requests | Read | View PR details |
| Commit statuses | Read | Check CI/CD status |
| Actions | Read | View workflow runs |
| Deployments | Read | Check deployment status |
Use fine-grained tokens when possible - they provide more granular control than classic tokens.
GitHub Enterprise
For GitHub Enterprise Server, provide the API URL:
https://github.your-company.com/api/v3
Example Queries
Once connected, you can ask the AI agent:
What changed in the last deployment to production?
Show me recent commits to the payment service
Were there any PRs merged today that touched the database code?
What's the status of the CI pipeline?
Troubleshooting
401 Unauthorized
- Verify the token is correct and hasn't expired
- Check that the token has access to the requested repositories
- For fine-grained tokens, ensure the correct organization is selected
403 Forbidden (SSO)
- If your organization uses SAML SSO, ensure you have authorized the token for SSO
- Go to Settings → Developer settings → Personal access tokens → Tokens (classic), click Configure SSO next to your token, and authorize it for the organization
404 Not Found
- Verify the repository exists and the token has access
- Check the organization/owner name is correct
- Ensure the repository isn't private without proper token access
Rate Limited
- GitHub has API rate limits (5,000 requests/hour for authenticated requests)
- Consider using a GitHub App for higher limits
- Wait for the rate limit to reset