Skip to main content

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:

MethodAuth MechanismBest ForToken Type
GitHub App (OAuth)User OAuth via Cloud ex Machina AppQuick setup, individual user grants the app accessOAuth access token
GitHub App (Installation)Org-wide installation of Cloud ex Machina AppProduction — no per-user re-auth, audit-friendlyInstallation token (auto-renewed)
GitHub PATPersonal Access Token from a dedicated service accountEnvironments where third-party Apps are restricted, or self-hosted GitHub Enterprise ServerLong-lived PAT
Recommended Path

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:

ScopePurpose
repoFull access to repos the user can access — read content, create branches, commit files, open pull requests
read:orgList organizations and members the user belongs to (for ticket assignment)
read:userResolve GitHub username from email (for issue assignees)
user:emailAccess the user's verified email addresses

Setup​

  1. In Cloud ex Machina, go to Settings → Integrations
  2. Find GitHub in the list and click Connect
  3. You will be redirected to GitHub to authorize the Cloud ex Machina App
  4. Click Authorize
  5. Configure Owner (organization or user) and Repository in the integration settings modal
Per-User Authorization

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.

PermissionAPI nameAccess LevelUsed For
ActionsactionsRead & WriteRead workflows, workflow runs and jobs for CI analysis. Cloud ex Machina does not start, re-run or cancel a workflow
AdministrationadministrationReadRead repository traffic (views, clones, paths, referrers) and deploy keys
ContentscontentsRead & WriteRead files, commits and releases for remediation analysis. Create the branch and the commits of a remediation pull request
IssuesissuesRead & WriteCreate and list issues for cost optimization opportunities
MetadatametadataReadMandatory. List repositories, branches and the default branch
Pull requestspull_requestsRead & WriteOpen pull requests with AI-generated infrastructure changes. When a pull request merges, close its opportunity. Read pull requests and reviews for activity analysis
WorkflowsworkflowsRead & WriteGitHub requires it when a remediation commit changes a file in .github/workflows/

Organization permissions​

PermissionAPI nameAccess LevelUsed For
Administrationorganization_administrationReadRead the GitHub Apps installed on the organization, and the organization billing usage report (cost and usage per product, SKU and repository)
MembersmembersReadList organization members for ticket assignment. Read teams and team repositories for ownership
PlanplanReadRead the organization plan and its seat counts
Projectsorganization_projectsReadList organization projects so that you can link tickets to a project
Copilot metricsorganization_copilot_metricsReadRead Copilot usage metrics for the organization
GitHub Copilot Businessorganization_copilot_seat_managementReadRead 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.

PermissionAPI nameAccess LevelUsed For
Enterprise billingenterprise_billingReadRead the enterprise billing usage report (cost and usage per organization, repository, product and SKU)
Enterprise Copilot metricsenterprise_copilot_metricsReadRead Copilot usage metrics for the enterprise
Enterprise Copilot usageenterprise_copilot_usageReadRead Copilot usage for the enterprise
Enterprise peopleenterprise_peopleReadList enterprise members, to find paid seats that have no activity
Enterprise teamsenterprise_teamsReadList enterprise teams for ownership
Billing usage, Copilot and enterprise data

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.

PermissionAPI nameAccess Level
Commit statusesstatusesRead & Write
Custom organization rolesorganization_custom_org_rolesRead
Custom repository rolesorganization_custom_rolesRead
Custom enterprise rolesenterprise_custom_enterprise_rolesRead
Email addresses (account)emailsRead
EnvironmentsenvironmentsRead
Issue typesissue_typesRead
Projects (repository)repository_projectsRead
Webhooks (repository)repository_hooksRead & Write
Permission updates need your approval

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​

  1. In Cloud ex Machina, go to Settings → Integrations
  2. Find GitHub App in the list and click Connect
  3. You will be redirected to GitHub to install the Cloud ex Machina App
  4. Choose All repositories or Only select repositories (recommended — pick only the repos that hold infrastructure source code)
  5. Click Install
  6. Configure Owner and Repository in the integration settings modal
No Per-User Re-Auth

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.

Use a Service Account, Not a Personal Account

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​

ScopePurpose
repoFull access to private and public repos — read content, create branches, commit files, open pull requests, read PR metadata
read:orgList organization members, repos, and GitHub Projects
read:userResolve GitHub username from email (for issue assignees)
user:emailAccess 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.

PermissionAccess LevelUsed For
ContentsRead & WriteRead files, create branches, commit files
Pull requestsRead & WriteCreate and list PRs
IssuesRead & WriteCreate and list issues
MetadataReadMandatory — list repositories
MembersReadList organization members
Fine-grained Limitation

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​

  1. 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)
  2. Set a strong password stored in a team password manager
  3. Enable 2FA with a TOTP secret shared in your team vault (Authy, 1Password, etc.) — most orgs require 2FA. Do not use a personal phone.
  4. Verify the email address — GitHub sends security notifications (token created/revoked/expired) that must be read by your security/devops team
Seat Cost

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​

  1. Sign in to GitHub as an organization owner
  2. Navigate to your organization's People tab
  3. Click Invite member and add the service account email
  4. Assign the Member role (avoid Owner unless strictly necessary)
  5. 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​

  1. Sign in to GitHub as the service account
  2. Go to Settings → Developer settings → Personal access tokens
  3. 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
  4. 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
  5. Critical: Copy the token immediately — it is shown only once. Store it in a password manager or secrets vault before leaving the page.
Token Security

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​

  1. Go to Settings → Integrations
  2. Find GitHub PAT in the list and click Connect
  3. Paste the PAT into the connection dialog
  4. Click Save
  5. 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​

AreaTables
Organizationgithub_organizations, github_organization_members, github_installations, github_external_groups
Teamsgithub_teams, github_team_members, github_team_repositories
Repositoriesgithub_repositories, github_repository_branches, github_repository_keys, github_releases, github_release_assets, github_repository_sboms (dependency list)
Issuesgithub_issues
CIgithub_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.

TablesGitHub permission they need
github_organization_dependabot_alerts, github_repository_dependabot_alertsDependabot alerts
github_organization_dependabot_secrets, github_repository_dependabot_secretsDependabot secrets (names only, never the values)
github_hooks, github_hook_deliveriesOrganization 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​

TableContent
github_repository_commitsCommits of the previous day: author, date, message, SHA
github_pull_requestsPull requests updated the previous day
github_pull_request_reviewsReviews 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 repo scope is checked (full access required)
  • PAT (fine-grained): Ensure Contents: Read & Write and Pull requests: Read & Write are granted
  • App Installation: Re-install the App and verify the listed permissions match the ones in Method 2

Security Best Practices​

  1. Prefer the GitHub App (Installation) for production deployments
  2. Never use a PAT from an individual user account — always use a dedicated service account
  3. Store PATs in a password manager or secrets vault — never in a repo, ticket, or chat message
  4. Rotate PATs every 90 days at minimum, before expiration
  5. Use fine-grained PATs when your org's security policy allows them — they offer better scoping than classic PATs
  6. Grant the minimum required repository access — list specific repos rather than "all repositories" wherever possible
  7. Monitor GitHub audit logs for unexpected activity by the integration's account
  8. 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