GitHub Integration
The GitHub integration enables Cloud ex Machina to:
- Create and manage issues for cost optimization opportunities
- Open pull requests with infrastructure-as-code changes generated by the AI agent
- Read repository files to inform remediation analysis
- List organization members for ticket assignment
- Collect GitHub inventory, CI and activity data (see Data we collect)
Choosing the Right Connection Method
Cloud ex Machina supports three ways to connect to GitHub. Pick the one that matches your security posture and constraints:
| Method | Auth Mechanism | Best For | Token Type |
|---|---|---|---|
| GitHub App (OAuth) | User OAuth via Cloud ex Machina App | Quick setup, individual user grants the app access | OAuth access token |
| GitHub App (Installation) | Org-wide installation of Cloud ex Machina App | Production — no per-user re-auth, audit-friendly | Installation token (auto-renewed) |
| GitHub PAT | Personal Access Token from a dedicated service account | Environments where third-party Apps are restricted, or self-hosted GitHub Enterprise Server | Long-lived PAT |
The GitHub App (Installation) method provides the strongest security (scoped permissions, automatic token rotation, clear audit trail) and the simplest user experience (one-time install). Choose it whenever your organization's policies allow third-party GitHub Apps.
Choose the PAT method when your security policy forbids third-party Apps or when you operate on GitHub Enterprise Server without App support.
Method 1: GitHub App (OAuth)
In this mode, an individual GitHub user authorizes the Cloud ex Machina App on their own account. The integration acts on behalf of that user.
Permissions Granted
When the user clicks Authorize, GitHub requests the following OAuth scopes:
| Scope | Purpose |
|---|---|
repo | Full access to repos the user can access — read content, create branches, commit files, open pull requests |
read:org | List organizations and members the user belongs to (for ticket assignment) |
read:user | Resolve GitHub username from email (for issue assignees) |
user:email | Access the user's verified email addresses |
Setup
- In Cloud ex Machina, go to Settings → Integrations
- Find GitHub in the list and click Connect
- You will be redirected to GitHub to authorize the Cloud ex Machina App
- Click Authorize
- Configure Owner (organization or user) and Repository in the integration settings modal
This method ties the integration to a specific user account. If that user leaves the company or has their permissions revoked, the integration stops working. Avoid for production — use the Installation method or a PAT from a service account instead.
Method 2: GitHub App (Installation)
In this mode, an organization administrator installs the Cloud ex Machina App org-wide. The integration uses installation tokens, which are scoped to the org and rotate automatically — no per-user OAuth flow.
Permissions Granted
When an admin installs the Cloud ex Machina App, GitHub requests the permissions below. The API name is the key that GitHub shows in the app manifest and in the audit log.
Repository permissions
These apply to every repository that you select during the installation.
| Permission | API name | Access Level | Used For |
|---|---|---|---|
| Actions | actions | Read & Write | Read workflows, workflow runs and jobs for CI analysis. Cloud ex Machina does not start, re-run or cancel a workflow |
| Administration | administration | Read | Read repository traffic (views, clones, paths, referrers) and deploy keys |
| Contents | contents | Read & Write | Read files, commits and releases for remediation analysis. Create the branch and the commits of a remediation pull request |
| Issues | issues | Read & Write | Create and list issues for cost optimization opportunities |
| Metadata | metadata | Read | Mandatory. List repositories, branches and the default branch |
| Pull requests | pull_requests | Read & Write | Open pull requests with AI-generated infrastructure changes. When a pull request merges, close its opportunity. Read pull requests and reviews for activity analysis |
| Workflows | workflows | Read & Write | GitHub requires it when a remediation commit changes a file in .github/workflows/ |
Organization permissions
| Permission | API name | Access Level | Used For |
|---|---|---|---|
| Administration | organization_administration | Read | Read the GitHub Apps installed on the organization, and the organization billing usage report (cost and usage per product, SKU and repository) |
| Members | members | Read | List organization members for ticket assignment. Read teams and team repositories for ownership |
| Plan | plan | Read | Read the organization plan and its seat counts |
| Projects | organization_projects | Read | List organization projects so that you can link tickets to a project |
| Copilot metrics | organization_copilot_metrics | Read | Read Copilot usage metrics for the organization |
| GitHub Copilot Business | organization_copilot_seat_management | Read | Read Copilot seat assignments and last activity, to find unused seats |
Enterprise permissions
Enterprise permissions apply only when an enterprise owner also installs the app on the enterprise account. This is a second installation, in addition to the organization installation. When an enterprise pays for its organizations, GitHub reports their usage at the enterprise level only.
| Permission | API name | Access Level | Used For |
|---|---|---|---|
| Enterprise billing | enterprise_billing | Read | Read the enterprise billing usage report (cost and usage per organization, repository, product and SKU) |
| Enterprise Copilot metrics | enterprise_copilot_metrics | Read | Read Copilot usage metrics for the enterprise |
| Enterprise Copilot usage | enterprise_copilot_usage | Read | Read Copilot usage for the enterprise |
| Enterprise people | enterprise_people | Read | List enterprise members, to find paid seats that have no activity |
| Enterprise teams | enterprise_teams | Read | List enterprise teams for ownership |
The billing, plan and Copilot permissions are for the GitHub cost and usage analysis. Today, Cloud ex Machina does not collect the billing usage report, the Copilot data or the enterprise members and teams.
Permissions requested but not used today
No current feature uses these permissions.
| Permission | API name | Access Level |
|---|---|---|
| Commit statuses | statuses | Read & Write |
| Custom organization roles | organization_custom_org_roles | Read |
| Custom repository roles | organization_custom_roles | Read |
| Custom enterprise roles | enterprise_custom_enterprise_roles | Read |
| Email addresses (account) | emails | Read |
| Environments | environments | Read |
| Issue types | issue_types | Read |
| Projects (repository) | repository_projects | Read |
| Webhooks (repository) | repository_hooks | Read & Write |
When Cloud ex Machina adds a permission to the app, GitHub asks an organization owner to accept it. For an enterprise permission, GitHub asks an enterprise owner. Until an owner accepts, the installation keeps its previous permissions. The data that needs the new permission stays empty.
Setup
- In Cloud ex Machina, go to Settings → Integrations
- Find GitHub App in the list and click Connect
- You will be redirected to GitHub to install the Cloud ex Machina App
- Choose All repositories or Only select repositories (recommended — pick only the repos that hold infrastructure source code)
- Click Install
- Configure Owner and Repository in the integration settings modal
Once installed, the integration works independently of any user account. The token is renewed automatically every hour. If you need to revoke access, simply uninstall the App from your GitHub organization settings.
Method 3: GitHub PAT
The PAT method uses a long-lived Personal Access Token generated from a dedicated GitHub user account (a "machine user"). It is the right choice for environments where third-party Apps are not allowed or supported.
Always create a dedicated GitHub user account for this PAT — never use a token tied to an individual employee's personal account. See the Service Account Setup section below.
Permissions Granted
You can use either a classic PAT or a fine-grained PAT. Pick the one that matches your org's security policies.
Option A — Classic PAT scopes
| Scope | Purpose |
|---|---|
repo | Full access to private and public repos — read content, create branches, commit files, open pull requests, read PR metadata |
read:org | List organization members, repos, and GitHub Projects |
read:user | Resolve GitHub username from email (for issue assignees) |
user:email | Access verified emails (required by read:user) |
Option B — Fine-grained PAT permissions
Fine-grained PATs are scoped to a single organization at creation time. Pick this if your org enforces fine-grained PATs.
| Permission | Access Level | Used For |
|---|---|---|
| Contents | Read & Write | Read files, create branches, commit files |
| Pull requests | Read & Write | Create and list PRs |
| Issues | Read & Write | Create and list issues |
| Metadata | Read | Mandatory — list repositories |
| Members | Read | List organization members |
A fine-grained PAT only works for the org selected at creation. If you need to cover multiple orgs with one token, use a classic PAT instead.
Service Account Setup
GitHub has no native "service account" concept, so the standard pattern is to create a dedicated GitHub user account for the integration. This is officially called a Machine User and is accepted by GitHub's Terms of Service.
Step 1: Create the Service Account
- Create a new GitHub account using a shared team email (e.g.,
cxm-bot@yourcompany.com— ideally a distribution list or alias controlled by your IT/security team, never a personal mailbox) - Set a strong password stored in a team password manager
- Enable 2FA with a TOTP secret shared in your team vault (Authy, 1Password, etc.) — most orgs require 2FA. Do not use a personal phone.
- Verify the email address — GitHub sends security notifications (token created/revoked/expired) that must be read by your security/devops team
On GitHub Free, additional accounts are free. On GitHub Team/Enterprise, this account consumes one paid seat.
Step 2: Invite the Service Account to Your Organization
- Sign in to GitHub as an organization owner
- Navigate to your organization's People tab
- Click Invite member and add the service account email
- Assign the Member role (avoid Owner unless strictly necessary)
- Once the service account accepts the invitation, grant it access to the specific repositories Cloud ex Machina will operate on (via Settings → Teams or repo-level Settings → Collaborators)
Step 3: Generate the PAT
- Sign in to GitHub as the service account
- Go to Settings → Developer settings → Personal access tokens
- For a classic PAT:
- Click Tokens (classic) → Generate new token (classic)
- Note:
Cloud ex Machina Integration - Expiration: 90 days (recommended), set a calendar reminder for renewal
- Scopes: Check
repo,read:org,read:user,user:email - Click Generate token
- For a fine-grained PAT:
- Click Fine-grained tokens → Generate new token
- Resource owner: Select your organization
- Repository access: Select only the repos Cloud ex Machina will use
- Permissions: Set the permissions listed in Option B
- Click Generate token
- Critical: Copy the token immediately — it is shown only once. Store it in a password manager or secrets vault before leaving the page.
The PAT is displayed only once at creation. If you lose it, you must generate a new token and reconnect the integration. Never commit a PAT to a repository or share it via insecure channels.
Setup in Cloud ex Machina
- Go to Settings → Integrations
- Find GitHub PAT in the list and click Connect
- Paste the PAT into the connection dialog
- Click Save
- Configure Owner (the organization the service account is a member of) and Repository in the integration settings modal
Limitations vs the GitHub App
- No automatic PR-merged webhook routing: Pull requests merged in GitHub will not automatically transition opportunities to "Done" — transition them manually if needed.
- Rate limit: 5,000 requests/hour per PAT (vs 15,000 for a GitHub App). Monitor usage if you operate on many repos.
- Account dependency: If the service account is suspended or removed from the org, the integration breaks. Make sure the account is owned by your security/devops team, not an individual.
Data we collect
Cloud ex Machina runs two crawls for each connected GitHub organization. Both use the connection token, and both only read. The data goes to the data lake of your Cloud ex Machina organization.
Inventory crawl: weekly, Monday 03:00 UTC
| Area | Tables |
|---|---|
| Organization | github_organizations, github_organization_members, github_installations, github_external_groups |
| Teams | github_teams, github_team_members, github_team_repositories |
| Repositories | github_repositories, github_repository_branches, github_repository_keys, github_releases, github_release_assets, github_repository_sboms (dependency list) |
| Issues | github_issues |
| CI | github_workflows, github_workflow_runs, github_workflow_jobs |
| Traffic (last 14 days, as GitHub keeps it) | github_traffic_views, github_traffic_clones, github_traffic_paths, github_traffic_referrers |
The crawl also requests the tables below. With the GitHub App, they stay empty because the app does not request their permissions. They contain data only with a PAT that has the matching access.
| Tables | GitHub permission they need |
|---|---|
github_organization_dependabot_alerts, github_repository_dependabot_alerts | Dependabot alerts |
github_organization_dependabot_secrets, github_repository_dependabot_secrets | Dependabot secrets (names only, never the values) |
github_hooks, github_hook_deliveries | Organization webhooks |
The crawl also calls the GitHub per-product billing and workflow usage endpoints. GitHub closed these endpoints in 2025, and they return no data.
Activity crawl: daily, 04:00 UTC
| Table | Content |
|---|---|
github_repository_commits | Commits of the previous day: author, date, message, SHA |
github_pull_requests | Pull requests updated the previous day |
github_pull_request_reviews | Reviews of those pull requests, submitted the previous day |
The first run after you connect GitHub collects the last 90 days. Each next run collects one day.
Troubleshooting
"No GitHub connection configured"
Cause: The webhook from GitHub arrived but no matching connection exists in Cloud ex Machina.
Fix: Reconnect the integration, or check that the connection was not accidentally deleted.
"Token is invalid or expired"
Cause: The OAuth token, installation token, or PAT has expired or been revoked.
Fix:
- OAuth / App Installation: Reconnect from the Cloud ex Machina integrations page
- PAT: Generate a new PAT from the service account and update the connection
"Repository not found"
Cause: The configured owner/repo does not match any repository accessible to the connection.
Fix:
- Verify the owner and repository names are correct (case-sensitive)
- For PAT: confirm the service account has been granted access to the target repo
- For App Installation: re-check the Repository access setting in the GitHub App installation
Pull Requests Are Not Being Created
Cause: The token lacks write permissions on contents or pull requests.
Fix:
- PAT (classic): Ensure
reposcope is checked (full access required) - PAT (fine-grained): Ensure
Contents: Read & WriteandPull requests: Read & Writeare granted - App Installation: Re-install the App and verify the listed permissions match the ones in Method 2
Security Best Practices
- Prefer the GitHub App (Installation) for production deployments
- Never use a PAT from an individual user account — always use a dedicated service account
- Store PATs in a password manager or secrets vault — never in a repo, ticket, or chat message
- Rotate PATs every 90 days at minimum, before expiration
- Use fine-grained PATs when your org's security policy allows them — they offer better scoping than classic PATs
- Grant the minimum required repository access — list specific repos rather than "all repositories" wherever possible
- Monitor GitHub audit logs for unexpected activity by the integration's account
- Use a shared team email for the service account, not an individual's email
Next Steps
- Learn about other available integrations in Integrations Overview
- Configure additional providers to centralize your workflows