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
| Data | Permission | Why CloudYali needs it |
|---|---|---|
| Billed usage per day, product, SKU and repository: Actions, Packages, Git LFS, Codespaces, Copilot, Advanced Security and AI credits | Administration: read (required) | GitHub cost in every CloudYali feature |
| Copilot AI-credit spend by model, per month | Administration: read | Copilot spend by model. It is attribution and is never added to totals |
| GitHub's own budgets on the organization | Administration: read | Kept with the connection |
| The organization's Actions artifact and log retention | Administration: read | The retention savings check |
| Advanced Security committers: login and last push date | Administration: read | The inactive committers insight |
| Copilot seats: login, plan, the organization or team that assigned the seat, and last activity | GitHub Copilot Business: read (recommended) | The Copilot seats list and the idle seat check |
| Repository custom properties | Custom properties: read (recommended) | Tags in Cost Explorer, Budgets and Tag Governance |
| The organization's codespaces | Organization codespaces: read and repository Codespaces: read (recommended) | The Codespaces savings checks |
| Copilot usage metrics, members and teams | Organization 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
- Sign in to GitHub as an owner of the organization, or as the service account.
- Open Settings → Developer settings → Personal access tokens → Fine-grained tokens and select Generate new token.
- Enter a name, and set Resource owner to the organization.
- Choose an expiration. GitHub allows up to 366 days, and CloudYali warns you 14 days before the token expires.
- Under Repository access, choose All repositories, or Only select repositories to limit the Codespaces checks to those repositories.
- Under the organization permissions, set each permission in the table below to Read-only.
- Under the repository permissions, set Codespaces to Read-only. GitHub adds Metadata: Read-only by itself.
- Select Generate token and copy it. It starts with
github_pat_, and GitHub shows it only once.
| Permission | Level | Needed for |
|---|---|---|
| Administration | Organization | Billing usage, Copilot spend by model, retention and Advanced Security (required) |
| GitHub Copilot Business | Organization | Copilot seats and the idle seat check |
| Custom properties | Organization | Repository tags |
| Organization codespaces | Organization | The Codespaces checks, with the repository permission below |
| Organization Copilot metrics | Organization | Not used yet |
| Members | Organization | Not used yet |
| Codespaces | Repository | The 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
- In CloudYali, open Integrations, find GitHub under Developer platforms and select Connect.
- Enter the organization's login, as it appears in
github.com/ORGANIZATION. - For an organization on GHE.com, tick GHE.com data residency and enter the API host,
api.TENANT.ghe.com. - Enter a name for the connection, up to 100 characters.
- Paste the token.
- Select Test. CloudYali asks GitHub for each kind of data and lists what the token can read.
- 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
| Feature | What you see |
|---|---|
| Cost Explorer | GitHub 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 Views | Seven GitHub views, such as GitHub - Cost by Product, and the views for every provider |
| Budgets | Budgets on GitHub spend, by organization, product and tag |
| Cost Anomalies | A spike or new spend in one product of one organization, with the repositories and SKUs behind it |
| Dashboard | GitHub in Total Spend and Cost by Providers |
| Tag Governance | Repository custom properties as tag keys |
| Cost Savings | Six checks for Copilot seats, Actions, Codespaces and Advanced Security |
| Email reports | GitHub cost by product and organization |
| AI assistants | GitHub 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.
| Health | What it means | What to do |
|---|---|---|
| Pending | Connected, resumed or given a new token; the next sync checks it | Wait for the next sync, or select Sync now |
| Healthy | The last sync read billing usage. A note such as Optional data not granted to this token: … lists recommended permissions the token lacks | Nothing, or grant the permission and rotate the token |
| Degraded | Data 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 summary | Read the note. A rate limit clears by itself |
| Error | GitHub refused the token or the billing permission | Rotate the token; see Troubleshooting |
| Paused | You paused it, or 5 syncs in a row failed | Fix 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
| Data | How long |
|---|---|
| Billed usage | Kept after you remove the connection, as for other providers; see Retention and deletion. The cost pages show about the last 7 months |
| Copilot seats | While the seat exists in GitHub, then 90 days |
| Sync history | 90 days |
| Connection activity | Kept after you remove the connection |
| The token | Until 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.
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
| Symptom | Cause | Fix |
|---|---|---|
| GitHub rejected the token (401). Check that it is valid and not expired. | The token is mistyped, expired or revoked | Create 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 token | Create a fine-grained token with the organization as resource owner |
| Enterprise connections are not available yet. Connect each organization instead. | An enterprise slug was sent | Connect each organization of the enterprise |
| This GitHub scope is already connected. | The organization is already connected | Find it on the Connected tab |
| scope_slug must be a GitHub organization login or enterprise slug | The field holds a URL or a display name | Enter the login only, such as the part after github.com/ |
| api_host must be api.github.com or api.<tenant>.ghe.com | The GHE.com host is not an API host | Enter api.TENANT.ghe.com |
| GitHub could not be reached to validate the token; try again. | GitHub did not answer | Try again in a minute. Nothing was saved |
| Too many requests to the GitHub integration API, please try again later | Test and Connect share a limit of 10 requests a minute, and Sync now has 2 a minute | Wait a minute and try again |
| GitHub is unavailable | CloudYali turned the GitHub integration off for a while | Try 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 connected | Select 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 owner | Create 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 token | Nothing. CloudYali continues after the reset, and failures are not counted |
| The connection shows Paused and nobody paused it | 5 syncs in a row failed | Fix the cause in the health note, then select Resume |
| No Copilot seats, or no idle seat findings | The token lacks GitHub Copilot Business: read | Grant it and rotate the token |
| Codespaces checks miss private repositories | The token's repository access is Public repositories | Create 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.comand 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.