Skip to main content

Connect GitHub

Your GitHub organization's billed usage, Copilot seats and repository custom properties appear in CloudYali after you connect a fine-grained personal access token. CloudYali reads them once a day, with read-only permissions. Setup takes about 10 minutes.

Before you start​

  • A GitHub organization. CloudYali connects organizations on GitHub.com and on GHE.com (GitHub Enterprise Cloud with data residency). It cannot connect an enterprise account, a personal account or GitHub Enterprise Server. If your organizations belong to an enterprise, connect each one.
  • An organization owner. The token needs Administration: read on the organization, which only an owner can grant. Create it from a dedicated service account that is an owner, so the connection keeps working when people leave.
  • Fine-grained tokens allowed. The organization's settings must allow fine-grained personal access tokens. A classic token cannot read organization billing.
  • In CloudYali, you need the owner or admin role to connect, replace the token of, pause, resume or remove a GitHub organization. Every user can see the connection and select Sync now.

What CloudYali can read​

DataPermissionWhy CloudYali needs it
Billed usage per day, product, SKU and repository: Actions, Packages, Git LFS, Codespaces, Copilot, Advanced Security and AI creditsAdministration: read (required)GitHub cost in every CloudYali feature
Copilot AI-credit spend by model, per monthAdministration: readCopilot spend by model. It is attribution and is never added to totals
GitHub's own budgets on the organizationAdministration: readKept with the connection
The organization's Actions artifact and log retentionAdministration: readThe retention savings check
Advanced Security committers: login and last push dateAdministration: readThe inactive committers insight
Copilot seats: login, plan, the organization or team that assigned the seat, and last activityGitHub Copilot Business: read (recommended)The Copilot seats list and the idle seat check
Repository custom propertiesCustom properties: read (recommended)Tags in Cost Explorer, Budgets and Tag Governance
The organization's codespacesOrganization codespaces: read and repository Codespaces: read (recommended)The Codespaces savings checks
Copilot usage metrics, members and teamsOrganization Copilot metrics: read and Members: read (recommended)Checked when you connect, not used yet. Granting them now avoids a new token later

CloudYali stores GitHub logins and numeric IDs, never email addresses. The Advanced Security report carries each committer's push email, which CloudYali does not read. CloudYali sends only read requests to GitHub, and the token has no Contents permission, so it cannot read your code.

Cost centers belong to GitHub enterprises, so CloudYali does not read them for an organization.

Create the token​

  1. Sign in to GitHub as an owner of the organization, or as the service account.
  2. Open Settings → Developer settings → Personal access tokens → Fine-grained tokens and select Generate new token.
  3. Enter a name, and set Resource owner to the organization.
  4. Choose an expiration. GitHub allows up to 366 days, and CloudYali warns you 14 days before the token expires.
  5. Under Repository access, choose All repositories, or Only select repositories to limit the Codespaces checks to those repositories.
  6. Under the organization permissions, set each permission in the table below to Read-only.
  7. Under the repository permissions, set Codespaces to Read-only. GitHub adds Metadata: Read-only by itself.
  8. Select Generate token and copy it. It starts with github_pat_, and GitHub shows it only once.
PermissionLevelNeeded for
AdministrationOrganizationBilling usage, Copilot spend by model, retention and Advanced Security (required)
GitHub Copilot BusinessOrganizationCopilot seats and the idle seat check
Custom propertiesOrganizationRepository tags
Organization codespacesOrganizationThe Codespaces checks, with the repository permission below
Organization Copilot metricsOrganizationNot used yet
MembersOrganizationNot used yet
CodespacesRepositoryThe Codespaces checks

Only Administration: read is required. Without a recommended permission the connection still works, and the feature that needs it has no data.

Public repositories grants no repository permission, so the token cannot read private repositories' codespaces and the Codespaces checks do not see them.

Connect GitHub​

  1. In CloudYali, open Integrations, find GitHub under Developer platforms and select Connect.
  2. Enter the organization's login, as it appears in github.com/ORGANIZATION.
  3. For an organization on GHE.com, tick GHE.com data residency and enter the API host, api.TENANT.ghe.com.
  4. Enter a name for the connection, up to 100 characters.
  5. Paste the token.
  6. Select Test. CloudYali asks GitHub for each kind of data and lists what the token can read.
  7. Select Connect.

CloudYali checks the token with GitHub again before it stores it. Connect stays off while the token cannot read billing usage. The token is stored encrypted, and the console shows only its last characters.

After you connect​

The connection appears on the Connected tab of Integrations with the health Pending. Nothing is read at the moment you connect.

  • First sync. It runs with the next daily sync, at about 13:06 UTC, or within about 5 minutes if you select Sync now. It reads 7 months of usage, from the 1st of the month 7 months ago.
  • Large backfills. When GitHub's rate limit stops a sync, CloudYali keeps the months it has finished and continues after the limit resets. The health reads Degraded until then.
  • Every day after that. The daily sync reads the last 7 days again, and the whole previous month until the 5th, because GitHub can correct recent days.
  • Savings checks. They run at the end of the daily sync, not after Sync now. Their opportunities reach Cost Savings with its daily refresh, at about 15:00 UTC.

Where GitHub data appears​

FeatureWhat you see
Cost ExplorerGitHub as a provider: organization as the account, product as the service, SKU as the usage type and Global as the region. A group's resources are its repositories
Cost ViewsSeven GitHub views, such as GitHub - Cost by Product, and the views for every provider
BudgetsBudgets on GitHub spend, by organization, product and tag
Cost AnomaliesA spike or new spend in one product of one organization, with the repositories and SKUs behind it
DashboardGitHub in Total Spend and Cost by Providers
Tag GovernanceRepository custom properties as tag keys
Cost SavingsSix checks for Copilot seats, Actions, Codespaces and Advanced Security
Email reportsGitHub cost by product and organization
AI assistantsGitHub cost, savings and connection health

GitHub has no resources in Resource Inventory and no commitments in Commitments.

Connection health​

The Connected tab shows each GitHub connection's health. Select the row to open its details: the health note, the token's expiry, the last day of complete data, the last successful sync and the checklist of what the token can read.

HealthWhat it meansWhat to do
PendingConnected, resumed or given a new token; the next sync checks itWait for the next sync, or select Sync now
HealthyThe last sync read billing usage. A note such as Optional data not granted to this token: … lists recommended permissions the token lacksNothing, or grant the permission and rotate the token
DegradedData still arrives, but part of the sync did not finish: a rate limit, a permission that stopped working, or a month that disagrees with GitHub's summaryRead the note. A rate limit clears by itself
ErrorGitHub refused the token or the billing permissionRotate the token; see Troubleshooting
PausedYou paused it, or 5 syncs in a row failedFix the cause, then select Resume

When the token expires within 14 days, the details show a warning and the health note says The GitHub token expires on and the date. Rotate the token before then to avoid a gap.

The details also have three more tabs. Activity lists who connected, rotated, paused, resumed or synced the connection, and when. Copilot seats lists each seat assignment with its login, the organization or team that assigned it, its plan and its last activity, and filters by days inactive. Settings holds the actions below.

Sync, rotate, pause or remove​

All four actions are on the Settings tab of the connection's details.

  • Sync now queues a sync that starts within about 5 minutes. A paused connection is not queued.
  • Rotate token replaces the token after checking that it can read the same organization. The history is kept, and a connection in Error or Degraded goes back to Pending.
  • Pause stops syncing and keeps the data. Resume sets the connection to Pending, and the next sync catches up on the days it missed.
  • Remove disconnects the organization.

When you remove a connection:

  • The cost history already collected stays in CloudYali.
  • CloudYali deletes the stored token at once. Revoke the token in GitHub too.
  • Copilot seat records, with their logins and activity, are deleted 90 days later.
  • The connection's savings opportunities close as No longer detected after the next daily sync and Cost Savings refresh.
  • Connecting the same organization again later replaces the days the two connections share.

What CloudYali keeps​

DataHow long
Billed usageKept after you remove the connection, as for other providers; see Retention and deletion. The cost pages show about the last 7 months
Copilot seatsWhile the seat exists in GitHub, then 90 days
Sync history90 days
Connection activityKept after you remove the connection
The tokenUntil you rotate it or remove the connection

GitHub serves 24 months of usage, so a month older than that cannot be read from GitHub again.

GitHub billed through Microsoft Azure​

If you pay for GitHub through Microsoft Azure, your Azure bill has lines with the meter category GitHub. In each month your GitHub connection reports, CloudYali counts those lines under GitHub only, so they are not counted twice.

caution

Your Azure total in CloudYali can then read lower than the Azure invoice by the GitHub amount. In months the GitHub connection does not report, the lines stay under Azure.

Troubleshooting​

SymptomCauseFix
GitHub rejected the token (401). Check that it is valid and not expired.The token is mistyped, expired or revokedCreate a new token and paste all of it
The token cannot read the required billing data.The token lacks Administration: read, its resource owner is another account, or it is a classic tokenCreate a fine-grained token with the organization as resource owner
Enterprise connections are not available yet. Connect each organization instead.An enterprise slug was sentConnect each organization of the enterprise
This GitHub scope is already connected.The organization is already connectedFind it on the Connected tab
scope_slug must be a GitHub organization login or enterprise slugThe field holds a URL or a display nameEnter the login only, such as the part after github.com/
api_host must be api.github.com or api.<tenant>.ghe.comThe GHE.com host is not an API hostEnter api.TENANT.ghe.com
GitHub could not be reached to validate the token; try again.GitHub did not answerTry again in a minute. Nothing was saved
Too many requests to the GitHub integration API, please try again laterTest and Connect share a limit of 10 requests a minute, and Sync now has 2 a minuteWait a minute and try again
GitHub is unavailableCloudYali turned the GitHub integration off for a whileTry again later, or ask support@cloudyali.io
Health Error: GitHub rejected the token (401) — rotate it to resume syncing.The token expired or was revoked after you connectedSelect Rotate token with a new token
Health Error: GitHub denied access to billing usage (403) — the token needs a fine-grained token with 'Administration: read'.The permission was removed, or the token's owner is no longer an organization ownerCreate a token with Administration: read and rotate it
Health Degraded: GitHub rate limited until …; syncing resumes automatically after the reset.GitHub's API rate limit for the tokenNothing. CloudYali continues after the reset, and failures are not counted
The connection shows Paused and nobody paused it5 syncs in a row failedFix the cause in the health note, then select Resume
No Copilot seats, or no idle seat findingsThe token lacks GitHub Copilot Business: readGrant it and rotate the token
Codespaces checks miss private repositoriesThe token's repository access is Public repositoriesCreate a token with All repositories or the selected ones, and rotate it

Limits​

  • Organizations only. Enterprise connections are refused. Connect each organization instead.
  • No GitHub Enterprise Server. CloudYali reads only api.github.com and GHE.com hosts.
  • Client workspaces. Add a GitHub organization to a client workspace as you add any other account. Its members then see that organization's GitHub spend, budgets, anomalies and daily report.
  • No resources. GitHub has no Resource Inventory entries. Repository cost is in Cost Explorer's breakdown.
  • Copilot metrics and members are not used yet. CloudYali checks these permissions when you connect, for features that come later.