GitHub API: 获取计费配额重置日期

GitHub API: get billing quota reset date

有没有 GitHub API 我可以用来检索天数 X

GitHub Actions

Included minutes quota resets in X days

您可以在 https://github.com/settings/billing 页面上找到哪些内容?

执行以下 API 调用

# GITHUB_TOKEN with "Update ALL user data" permission
curl \
  -H "Authorization: token $GITHUB_TOKEN" \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/users/$GITHUB_USER/settings/billing/actions

我得到了除计费周期截止日期之外的所有信息:

{
  "total_minutes_used": 228,
  "total_paid_minutes_used": 0,
  "included_minutes": 2000,
  "minutes_used_breakdown": {
    "UBUNTU": 228
  }
}

非常感谢。

我已经计算出 “计费周期剩余天数” 可以从 /users/<user>/settings/billing/shared-storage 端点检索。

例如

curl \
  -H "Authorization: token $GITHUB_TOKEN" \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/users/$GITHUB_USER/settings/billing/shared-storage

returns

{
  "days_left_in_billing_cycle": 5,
  "estimated_paid_storage_for_month": 0,
  "estimated_storage_for_month": 0
}