Skip to main content

从用于之前计费平台的终结点进行迁移

如果你的组织以前使用过预先按流量计费的计费平台,本文介绍如何将现有使用情况报告迁移到当前的计费使用情况终结点。

谁可以使用此功能?

Enterprise owners, organization owners, and billing managers

新的计费平台现可供所有用户使用。

After you transition to metered billing, the endpoints you used to get data from the previous billing platform will no longer return accurate usage information.

You will need to upgrade all calls using the previous /ACCOUNT-TYPE/NAME/settings/billing/PRODUCT REST API endpoints to use the equivalent /ACCOUNT-TYPE/NAME/settings/billing/usage endpoint.

Changes in authentication

If you used a fine-grained personal access token to authenticate with the previous endpoints, you will need create a personal access token (classic) to authenticate with the new endpoint.

In addition, you may want to use the new query parameters to specify a time period or cost center.

Calculating GitHub Actions information from the new response data

Example of the previous response

{"total_minutes_used": 305, "total_paid_minutes_used": 0, "included_minutes": 3000, "minutes_used_breakdown": { "UBUNTU": 205, "MACOS": 10, "WINDOWS": 90 }  }

Example of the new response

{ "usageItems": [ { "date": "2023-08-01", "product": "Actions", "sku": "Actions Linux", "quantity": 100, "unitType": "minutes", "pricePerUnit": 0.008, "grossAmount": 0.8, "discountAmount": 0, "netAmount": 0.8, "organizationName": "GitHub", "repositoryName": "github/example"} ] }

To get the same values from the new response data:

Previous propertyCalculate from new API response
total_minutes_used
  1. Filter results by "product": "Actions" and "unitType": "minutes"
  2. Sum quantity
total_paid_minutes_usedThis is now represented as a $ amount via netAmount.
  1. Filter results by "product": "Actions" and "unitType": "minutes"
  2. Sum netAmount
included_minutesThis is now represented as a $ amount via discountAmount.
  1. Filter results by "product": "Actions" and "unitType": "minutes"
  2. Sum discountAmount
minutes_used_breakdown
  1. Filter results by "product": "Actions" and "unitType": "minutes"
  2. Sum quantity grouped by sku

Calculating GitHub Packages information from the new response data

Example of the previous response

{ "total_gigabytes_bandwidth_used": 50, "total_paid_gigabytes_bandwidth_used": 40, "included_gigabytes_bandwidth": 10 }

Example of the new response

{ "usageItems": [ { "date": "2023-08-01", "product": "Packages", "sku": "Packages data transfer", "quantity": 100, "unitType": "gigabytes", "pricePerUnit": 0.008, "grossAmount": 0.8, "discountAmount": 0, "netAmount": 0.8, "organizationName": "GitHub", "repositoryName": "github/example" } ] }
Previous propertyCalculate from new API response
total_gigabytes_bandwidth_used
  1. Filter results by "product": "Packages" and "unitType": "gigabytes"
  2. Sum quantity
total_paid_gigabytes_bandwidth_usedThis is now represented as a $ amount via netAmount.
  1. Filter results by "product": "Packages" and "unitType": "gigabytes"
  2. Sum netAmount
included_gigabytes_bandwidthThis is now represented as a $ amount via discountAmount.
  1. Filter results by "product": "Packages" and "unitType": "gigabytes"
  2. Sum discountAmount

Calculating shared storage information from the new response data

Example of the previous response

{ "days_left_in_billing_cycle": 20, "estimated_paid_storage_for_month": 15, "estimated_storage_for_month": 40 }

Example of the new response

{ "usageItems": [ { "date": "2023-08-01", "product": "Packages", "sku": "Packages storage", "quantity": 100, "unitType": "GigabyteHours", "pricePerUnit": 0.008, "grossAmount": 0.8, "discountAmount": 0, "netAmount": 0.8, "organizationName": "GitHub", "repositoryName": "github/example" } ] }
Previous propertyCalculate from new API response
days_left_in_billing_cycleNot available. This information can be inferred by subtracting the current day of the month from the number of days in the current month.
estimated_paid_storage_for_monthThis is now represented as a $ amount via netAmount.

Prerequisite: pass the month and year query parameters.

For Actions storage
  1. Filter results by "product": "Actions" and "unitType": "GigabyteHours"
  2. Sum netAmount
For Packages storage
  1. Filter results by "product": "Packages" and "unitType": "GigabyteHours"
  2. Sum netAmount
estimated_storage_for_monthPrerequisite: pass the month and year query parameters.

For Actions storage
  1. Filter results by "product": "Actions" and "unitType": "GigabyteHours"
  2. Sum quantity
For Packages storage
  1. Filter results by "product": "Packages" and "unitType": "GigabyteHours"
  2. Sum quantity