Skip to content

Commit 0730270

Browse files
authored
chore!: Remove ActionsBilling endpoints for User and Organization (#3701)
1 parent 5cf155c commit 0730270

File tree

2 files changed

+0
-203
lines changed

2 files changed

+0
-203
lines changed

github/billing.go

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ import (
1616
// GitHub API docs: https://docs.github.com/rest/billing
1717
type BillingService service
1818

19-
// ActionBilling represents a GitHub Action billing.
20-
type ActionBilling struct {
21-
TotalMinutesUsed float64 `json:"total_minutes_used"`
22-
TotalPaidMinutesUsed float64 `json:"total_paid_minutes_used"`
23-
IncludedMinutes float64 `json:"included_minutes"`
24-
MinutesUsedBreakdown MinutesUsedBreakdown `json:"minutes_used_breakdown"`
25-
}
26-
2719
// MinutesUsedBreakdown counts the actions minutes used by machine type (e.g. UBUNTU, WINDOWS, MACOS).
2820
type MinutesUsedBreakdown = map[string]int
2921

@@ -103,27 +95,6 @@ type UsageReport struct {
10395
UsageItems []*UsageItem `json:"usageItems,omitempty"`
10496
}
10597

106-
// GetActionsBillingOrg returns the summary of the free and paid GitHub Actions minutes used for an Org.
107-
//
108-
// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-an-organization
109-
//
110-
//meta:operation GET /orgs/{org}/settings/billing/actions
111-
func (s *BillingService) GetActionsBillingOrg(ctx context.Context, org string) (*ActionBilling, *Response, error) {
112-
u := fmt.Sprintf("orgs/%v/settings/billing/actions", org)
113-
req, err := s.client.NewRequest("GET", u, nil)
114-
if err != nil {
115-
return nil, nil, err
116-
}
117-
118-
actionsOrgBilling := new(ActionBilling)
119-
resp, err := s.client.Do(ctx, req, actionsOrgBilling)
120-
if err != nil {
121-
return nil, resp, err
122-
}
123-
124-
return actionsOrgBilling, resp, nil
125-
}
126-
12798
// GetPackagesBillingOrg returns the free and paid storage used for GitHub Packages in gigabytes for an Org.
12899
//
129100
// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-packages-billing-for-an-organization
@@ -193,27 +164,6 @@ func (s *BillingService) GetAdvancedSecurityActiveCommittersOrg(ctx context.Cont
193164
return activeOrgCommitters, resp, nil
194165
}
195166

196-
// GetActionsBillingUser returns the summary of the free and paid GitHub Actions minutes used for a user.
197-
//
198-
// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-a-user
199-
//
200-
//meta:operation GET /users/{username}/settings/billing/actions
201-
func (s *BillingService) GetActionsBillingUser(ctx context.Context, user string) (*ActionBilling, *Response, error) {
202-
u := fmt.Sprintf("users/%v/settings/billing/actions", user)
203-
req, err := s.client.NewRequest("GET", u, nil)
204-
if err != nil {
205-
return nil, nil, err
206-
}
207-
208-
actionsUserBilling := new(ActionBilling)
209-
resp, err := s.client.Do(ctx, req, actionsUserBilling)
210-
if err != nil {
211-
return nil, resp, err
212-
}
213-
214-
return actionsUserBilling, resp, nil
215-
}
216-
217167
// GetPackagesBillingUser returns the free and paid storage used for GitHub Packages in gigabytes for a user.
218168
//
219169
// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-packages-billing-for-a-user

github/billing_test.go

Lines changed: 0 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -14,68 +14,6 @@ import (
1414
"github.com/google/go-cmp/cmp"
1515
)
1616

17-
func TestBillingService_GetActionsBillingOrg(t *testing.T) {
18-
t.Parallel()
19-
client, mux, _ := setup(t)
20-
21-
mux.HandleFunc("/orgs/o/settings/billing/actions", func(w http.ResponseWriter, r *http.Request) {
22-
testMethod(t, r, "GET")
23-
fmt.Fprint(w, `{
24-
"total_minutes_used": 305.0,
25-
"total_paid_minutes_used": 0.0,
26-
"included_minutes": 3000.0,
27-
"minutes_used_breakdown": {
28-
"UBUNTU": 205,
29-
"MACOS": 10,
30-
"WINDOWS": 90
31-
}
32-
}`)
33-
})
34-
35-
ctx := context.Background()
36-
hook, _, err := client.Billing.GetActionsBillingOrg(ctx, "o")
37-
if err != nil {
38-
t.Errorf("Billing.GetActionsBillingOrg returned error: %v", err)
39-
}
40-
41-
want := &ActionBilling{
42-
TotalMinutesUsed: 305.0,
43-
TotalPaidMinutesUsed: 0.0,
44-
IncludedMinutes: 3000.0,
45-
MinutesUsedBreakdown: MinutesUsedBreakdown{
46-
"UBUNTU": 205,
47-
"MACOS": 10,
48-
"WINDOWS": 90,
49-
},
50-
}
51-
if !cmp.Equal(hook, want) {
52-
t.Errorf("Billing.GetActionsBillingOrg returned %+v, want %+v", hook, want)
53-
}
54-
55-
const methodName = "GetActionsBillingOrg"
56-
testBadOptions(t, methodName, func() (err error) {
57-
_, _, err = client.Billing.GetActionsBillingOrg(ctx, "\n")
58-
return err
59-
})
60-
61-
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
62-
got, resp, err := client.Billing.GetActionsBillingOrg(ctx, "o")
63-
if got != nil {
64-
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
65-
}
66-
return resp, err
67-
})
68-
}
69-
70-
func TestBillingService_GetActionsBillingOrg_invalidOrg(t *testing.T) {
71-
t.Parallel()
72-
client, _, _ := setup(t)
73-
74-
ctx := context.Background()
75-
_, _, err := client.Billing.GetActionsBillingOrg(ctx, "%")
76-
testURLParseError(t, err)
77-
}
78-
7917
func TestBillingService_GetPackagesBillingOrg(t *testing.T) {
8018
t.Parallel()
8119
client, mux, _ := setup(t)
@@ -180,68 +118,6 @@ func TestBillingService_GetStorageBillingOrg_invalidOrg(t *testing.T) {
180118
testURLParseError(t, err)
181119
}
182120

183-
func TestBillingService_GetActionsBillingUser(t *testing.T) {
184-
t.Parallel()
185-
client, mux, _ := setup(t)
186-
187-
mux.HandleFunc("/users/u/settings/billing/actions", func(w http.ResponseWriter, r *http.Request) {
188-
testMethod(t, r, "GET")
189-
fmt.Fprint(w, `{
190-
"total_minutes_used": 10,
191-
"total_paid_minutes_used": 0,
192-
"included_minutes": 3000,
193-
"minutes_used_breakdown": {
194-
"UBUNTU": 205,
195-
"MACOS": 10,
196-
"WINDOWS": 90
197-
}
198-
}`)
199-
})
200-
201-
ctx := context.Background()
202-
hook, _, err := client.Billing.GetActionsBillingUser(ctx, "u")
203-
if err != nil {
204-
t.Errorf("Billing.GetActionsBillingUser returned error: %v", err)
205-
}
206-
207-
want := &ActionBilling{
208-
TotalMinutesUsed: 10,
209-
TotalPaidMinutesUsed: 0,
210-
IncludedMinutes: 3000,
211-
MinutesUsedBreakdown: MinutesUsedBreakdown{
212-
"UBUNTU": 205,
213-
"MACOS": 10,
214-
"WINDOWS": 90,
215-
},
216-
}
217-
if !cmp.Equal(hook, want) {
218-
t.Errorf("Billing.GetActionsBillingUser returned %+v, want %+v", hook, want)
219-
}
220-
221-
const methodName = "GetActionsBillingUser"
222-
testBadOptions(t, methodName, func() (err error) {
223-
_, _, err = client.Billing.GetActionsBillingOrg(ctx, "\n")
224-
return err
225-
})
226-
227-
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
228-
got, resp, err := client.Billing.GetActionsBillingUser(ctx, "o")
229-
if got != nil {
230-
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
231-
}
232-
return resp, err
233-
})
234-
}
235-
236-
func TestBillingService_GetActionsBillingUser_invalidUser(t *testing.T) {
237-
t.Parallel()
238-
client, _, _ := setup(t)
239-
240-
ctx := context.Background()
241-
_, _, err := client.Billing.GetActionsBillingUser(ctx, "%")
242-
testURLParseError(t, err)
243-
}
244-
245121
func TestBillingService_GetPackagesBillingUser(t *testing.T) {
246122
t.Parallel()
247123
client, mux, _ := setup(t)
@@ -365,35 +241,6 @@ func TestMinutesUsedBreakdown_Marshal(t *testing.T) {
365241
testJSONMarshal(t, u, want)
366242
}
367243

368-
func TestActionBilling_Marshal(t *testing.T) {
369-
t.Parallel()
370-
testJSONMarshal(t, &MinutesUsedBreakdown{}, "{}")
371-
372-
u := &ActionBilling{
373-
TotalMinutesUsed: 1,
374-
TotalPaidMinutesUsed: 1,
375-
IncludedMinutes: 1,
376-
MinutesUsedBreakdown: MinutesUsedBreakdown{
377-
"UBUNTU": 1,
378-
"MACOS": 1,
379-
"WINDOWS": 1,
380-
},
381-
}
382-
383-
want := `{
384-
"total_minutes_used": 1,
385-
"total_paid_minutes_used": 1,
386-
"included_minutes": 1,
387-
"minutes_used_breakdown": {
388-
"UBUNTU": 1,
389-
"MACOS": 1,
390-
"WINDOWS": 1
391-
}
392-
}`
393-
394-
testJSONMarshal(t, u, want)
395-
}
396-
397244
func TestPackageBilling_Marshal(t *testing.T) {
398245
t.Parallel()
399246
testJSONMarshal(t, &PackageBilling{}, "{}")

0 commit comments

Comments
 (0)